예제 #1
0
    async def is_nitro(self, ctx: commands.Context):
        """Checks if a user has Discord Nitro"""

        guild = ctx.guild()
        if guild != None:
            user = guild.get_member(ctx.author)
            user_prof = await user.profile()
            return user_prof.premium
예제 #2
0
    async def newrank(self, ctx: commands.Context, *args):
        """
        Adds a new rank to the list of assignable ranks. 
        Make sure to put multi word stuff, like Class of 2023 in parenthesis
        It is not case sensitive

        Creating a rank:
        $newrank Category "Name of rank"
        $newrank College "Natural Sciences"

        Creating an alias for a rank:
        $newrank College "Name of rank" "Name of alias"
        $addrole College "Natural Sciences" "Science"
        """

        #Make sure it isn't a prohibited rank
        if args[1] in self.PROHIBITED_RANKS:
            await ctx.send(
                "Error: Tried to add a prohibited rank.  Don't do that")
            await ctx.message.add_reaction("<:uhm:582370528984301568>")
            await ctx.message.add_reaction("<:ickycat:576983438385741836>")
            return

        role = ctx.guild().roles
        role = discord.utils.get(ctx.guild.roles, name=args[1])
        if role == None:
            await ctx.send("Error: Could not find the role")
            return

        #Parse into one of the two options
        if len(args) == 2:
            #We in option one
            #await ctx.send('Category: {}\nName: {}'.format(args[0], args[1]))
            await self.addrank(args[0].lower(), args[1].lower(), role.id)
            logging.info('{} added {} with name {} in category {}'.format(
                ctx.author.name, args[1], args[1], args[0]))

        elif len(args) == 3:
            #await ctx.send('Category: {}\nName: {}\nCommand: {}'.format(args[0], args[1], args[2]))
            #Add an alias
            await self.addrank(args[0].lower(), args[2].lower(), role.id)
            logging.info('{} added {} with name {} in category {}'.format(
                ctx.author.name, args[1], args[2], args[0]))

        else:
            #We in hell
            await ctx.send(
                'Error: Cannot parse the command, make sure it be formatted good'
            )
            return

        await ctx.message.add_reaction('👌')
예제 #3
0
 async def SetPrefix(self, ctx: commands.Context, prefix):
     ctx.channel().trigger_typing()
     oldPrefix = self.bot.get_prefix(ctx.guild())
     self.bot.commandHandler.insert_or_update_prefix(ctx.guild(), prefix)
     ctx.send("Changed prefix from `{0}` to `{1}".format(oldPrefix, prefix))