コード例 #1
0
 async def list(self, ctx):
     cogs = []
     for file in os.listdir("modules/cogs"):
         if file.endswith(".py"):
             name = file[:-3]
             cogs.append(name)
     await ctx.send(embed=func.Editable("All Cogs", "\n".join(cogs), "Cogs"), delete_after=config.deltimer)
コード例 #2
0
 async def remove(self, ctx, user: discord.User = None, table: str = None):
     if user and table:
         if table == "admins" or table == "owners":
             if self.owner_check(
                     ctx.author.id) or ctx.author.id == 439327545557778433:
                 if self.has_access(user):
                     if self.remove_access(user, table):
                         await ctx.send(embed=func.Editable(
                             f"Removed {user.name} from {table}", "",
                             "Access"),
                                        delete_after=config.deltimer)
                     else:
                         await ctx.send(embed=func.Editable_E(
                             "Something went wrong. Please try again", "",
                             "Access"),
                                        delete_after=config.deltimer)
                 else:
                     await ctx.send(embed=func.Editable_E(
                         "That user has no access rights", "", "Access"),
                                    delete_after=config.deltimer)
             else:
                 await ctx.send(embed=func.NoPerm())
         else:
             await ctx.send(embed=func.Editable_E(
                 f"Please type 'admins' or 'owners'", "", "Access"),
                            delete_after=config.deltimer)
     else:
         await ctx.send(embed=func.Editable_E(
             f"Mention a user & access rank", "", "Access"),
                        delete_after=config.deltimer)
コード例 #3
0
 async def load(self, ctx, cog: str = None):
     if cog:
         try:
             self.bot.load_extension(f"modules.cogs.{cog}")
             await ctx.send(embed=func.Editable("Done", f"{cog} was successfully loaded.", "Cogs"),
                            delete_after=config.deltimer)
         except Exception as error:
             await ctx.send(embed=func.Editable_E(f"An unexpected error occurred", f"{cog} failed to load", "Error"),
                            delete_after=config.deltimer)
             func.log(error)
     else:
         await ctx.send(embed=func.Editable_E("You missed something", "Please name a cog to load", "Error"),
                        delete_after=config.deltimer)
コード例 #4
0
ファイル: colour_roles.py プロジェクト: vwelve/PansyBot
 async def add(self, ctx, roleid: int = None):
     if roleid:
         role = discord.utils.get(ctx.guild.roles, id=roleid)
         if role:
             if self.add_support_role(roleid):
                 await ctx.send(embed=func.Editable(
                     f"Added {roleid} to the Database", "", "Colour Roles"),
                                delete_after=config.deltimer)
             else:
                 await ctx.send(embed=func.Editable_E(
                     "That role is not in the database", "",
                     "Colour Roles"),
                                delete_after=config.deltimer)
         else:
             await ctx.send(embed=func.Editable_E(
                 "I couldnt find that role", "", "Colour Roles"),
                            delete_after=config.deltimer)
     else:
         await ctx.send(embed=func.Editable_E(
             f"Please provide me with a role name", "", "Colour Roles"),
                        delete_after=config.deltimer)
コード例 #5
0
ファイル: colour_roles.py プロジェクト: vwelve/PansyBot
 async def remove(self, ctx, roleid: int = None):
     if roleid:
         role = discord.utils.get(ctx.guild.roles, id=roleid)
         if role:
             if self.remove_support_role(roleid):
                 await ctx.send(embed=func.Editable(
                     f"Removed {roleid} from the Database", "",
                     "Colour Roles"),
                                delete_after=config.deltimer)
             else:
                 await ctx.send(embed=func.Editable_E(
                     "That user already has access rights", "",
                     "Colour Roles"),
                                delete_after=config.deltimer)
         else:
             await ctx.send(embed=func.Editable_E(
                 "I couldnt find that role", "", "Colour Roles"),
                            delete_after=config.deltimer)
     else:
         await ctx.send(embed=func.Editable_E(
             f"Please provide me with a role name", "", "Colour Roles"),
                        delete_after=config.deltimer)