Esempio n. 1
0
 async def _unload(self, ctx, cog_, save: bool = False):
     if save:
         helpers.storage(self.bot, key='cogs', value=cog_, method='remove')
     self.bot.unload_extension(cog_)
     embed = ctx.embed(title='Success',
                       description='Saved Preference' if save else None,
                       color=discord.Color.green())
     await ctx.send(embed=embed)
Esempio n. 2
0
 async def _loadall(self, ctx):
     data = helpers.storage(self.bot)
     cogs = {'loaded': [], 'not': []}
     for cog_ in data['cogs']:
         if cog_ in bot.extensions:
             continue
         try:
             self.bot.load_extension(cog_)
             cogs['loaded'].append(cog_)
         except discord.DiscordException:
             cogs['not'].append(cog_)
     embed = ctx.embed(
         title='Load all cogs',
         description='\n'.join([
             ('\U00002705' if cog_ in cogs['loaded'] else '\U0000274c') +
             cog_ for cog_ in data['cogs']
         ]))
     await ctx.send(embed=embed)
Esempio n. 3
0
bot = helpers.Bot(command_prefix=prefix,
                  description='Coding Bot v4',
                  case_insensitive=True,
                  embed_color=discord.Color.blurple(),
                  intents=discord.Intents.all(),
                  help_command=CustomHelp())
load_dotenv()
if len(sys.argv) > 2:
    bot.token = sys.argv[2]
else:
    bot.token = os.getenv('BOT_TOKEN')
bot.default_owner = os.getenv('OWNER_ID')
os.environ["JISHAKU_NO_UNDERSCORE"] = "True"
os.environ['JISHAKU_RETAIN'] = "True"
init_data = helpers.storage(bot)


class Pools:
    config = asyncpg.create_pool(database='codingbot_db',
                                 init=helpers.init_connection)


bot.helpers = helpers
bot.tracker = DiscordUtils.InviteTracker(bot)
bot.default_prefixes = [',']
bot.server_cache = {}
bot.pools = Pools
bot.owner_id = None
bot.owner_ids = init_data['owners']
bot.blacklisted = init_data['blacklisted']