### Extensions // Cogs ### if __name__ == '__main__': #bot.remove_command("help") extensions = [ 'Activity', 'Arcade', 'Caption', 'Comic', 'CTAM', 'Fun', 'Info', 'Mod', 'Point', 'Ticket', 'OWS', 'Raffle', 'Rule', 'Shop', 'SQL', 'Video' ] for extension in extensions: try: bot.load_extension(extension) print('Loaded {}'.format(extension)) except Exception as error: print('{} cannot be loaded. [{}]'.format(extension, error)) bot.loop.create_task(Util.CheckForUpdate(bot)) bot.loop.create_task(Util.Backup(bot)) @commands.command(name="load") @Util.is_admin() async def load(ctx, extension=''): if extension == '': await ctx.send("Please Give A Valid Cog") try: bot.load_extension(extension) await ctx.send('Loaded {}'.format(extension)) except Exception as error: await ctx.send('{} cannot be loaded. [{}]'.format(extension, error)) bot.add_command(load)
for server in client.guilds: print(f'Guild name: {server.name}') print(f'Guild ID: {server.id}') await client.change_presence(activity=discord.Game("with points | ?help")) if __name__ == '__main__': extensions = {'Info', 'Point', 'Fun', 'Mod'} #'Points, 'Mod', 'Util' for extension in extensions: try: client.load_extension(extension) print(f'Loaded Cog {extension} successfully') except Exception as error: print(f'Failed to load Cog {extension}. Reason: {error}') # For taking backup of DB client.loop.create_task(Util.Backup(client)) # The following commands will be used to load Cogs # They are locked behind a has_role check which requires the user to have the "SleepBot Admin" role # This can be changed to allow people having Administrator permissions by changing the check to # @commands.has_permissions(administrator=True) @client.command(name='load') @commands.has_role("SleepBot Admin") async def load(ctx, extension): if extension == '': await ctx.send("Please enter a valid cog.") try: client.load_extension(extension) await ctx.send(f'Loaded {extension}!') except Exception as error: