async def cogs(self, ctx): colour = self.bot.get_colour(ctx.author.id) check = "'%l'[:-3] in self.bot.cogs" empty = "All cogs loaded" book = reactionbook(self.bot, ctx, TITLE="FBot Cogs") book.createpages(fn.getcogs(), EMPTY=empty, SUBHEADER="**Loaded:**", check1=(check, True)) book.createpages(fn.getcogs(), EMPTY=empty, SUBHEADER="**Not Loaded:**", check1=(check, False)) await book.createbook(MODE="numbers", COLOUR=colour)
def __init__(self): print(" > Preparing the bot") with open("settings.json", "r") as file: self.settings = fn.Classify(json.load(file)) self.devs = self.settings.devs intents = discord.Intents.none() intents.guilds = True intents.messages = True intents.reactions = True #intents.members = True # missing intents self.shards_ready = 0 super().__init__(command_prefix=fn.getprefix, intents=intents, shard_count=self.settings.shards) self.ready_shards_list = [False] * self.shard_count # TESTING self.ftime = fn.ftime() self.dbl = dbl.DBLClient(self, self.settings.tokens.topgg, webhook_path="/dblwebhook", webhook_auth=self.settings.tokens.auth, webhook_port=self.settings.port) fn.VotingHandler(self) self.add_check(self.predicate) db.setup() print("\n > Loaded the database") for csv in [tr, cmds]: csv.load() self.remove_command("help") for cog in fn.getcogs(): if cog not in []: print(f"\nLoading {cog}...", end="") try: self.reload_extension("cogs." + cog[:-3]) except: self.load_extension("cogs." + cog[:-3]) finally: print("Done", end="") print("\n\n > Loaded cogs\n")
async def load(self, ctx, cog): if cog == "all": unable = [] for cog in fn.getcogs(): cog = cog[:-3] try: self.bot.load_extension("cogs." + cog) except Exception as e: unable.append(cog) embed = self.bot.embed(ctx.author, "FBot cogs", "Loaded all cogs" + format_unable(unable)) else: try: self.bot.load_extension("cogs." + cog) embed = self.bot.embed(ctx.author, "FBot cogs", f"Loaded cog: `{cog}`") except Exception as e: embed = errorembed(f"Failed to load cog: {cog}", str(e)) await ctx.send(embed=embed)