Exemple #1
0
    async def help(self,
                   ctx: commands.Context,
                   *,
                   stuff: typing.Union[int, str] = None):
        """
        Async method of Help class, bot help command.

        Args:
            ctx(commands.Context): pass in context for analysis and reply
            stuff(typing.Union[int, str]): optional parameters for a specific help menu

        Returns:
            None
        """
        if ic(self, ctx.channel):
            return

        if not ctx.invoked_subcommand:
            data = self.help_pages(self.bot.loaded, prefix(self, ctx),
                                   self.bot.user.avatar_url_as(size=64), stuff)
            if data:
                message = await ctx.send(embed=data if stuff else data[0])
                if not stuff:
                    await self.paging(message, ctx.author, data, 0, True)
            else:
                await ctx.send("Can not find the specified help page")
Exemple #2
0
    async def fame_board(self, ctx: commands.Context):
        """
        Command and async method of Message, group command named fame_board and will send message on wrong usage or
        no additional param.

        Args:
            ctx(commands.Context): pass in context for reply

        Returns:
            None
        """
        if not ctx.invoked_subcommand:
            if not ic(self, ctx.channel):
                pre = prefix(self, ctx)
                embed = discord.Embed(
                    title="`Message` and Star board Commands", colour=0xf1c40f)
                embed.add_field(
                    inline=False,
                    name=f"{pre}fb info",
                    value="Obtain information about the fame board if it exist"
                )
                embed.add_field(
                    inline=False,
                    name=f"{pre}fb c <channel ID / mention> (emote amount req)",
                    value=
                    "Create a fame board with the requirement if it don't exist, emote amount "
                    "default to 3 if not specified")
                embed.add_field(inline=False,
                                name=f"{pre}fb delete",
                                value="Removes fame board if it exist")
                embed.add_field(inline=False,
                                name=f"{pre}modify <channel mention or ID>",
                                value="Changes the star board target channel")
                await ctx.send(embed=embed)
    async def antiraid(self, ctx: commands.Context):
        """
        Main command of the anti-raid, will be used to call other sub commands.

        Args:
            ctx (commands.Context): passing in context for reply

        Returns:
            None
        """
        if ctx.invoked_subcommand is None:
            pre = prefix(self, ctx)
            embed = discord.Embed(
                title="`Anti Raid` Commands",
                colour=0xf368e0
            )
            embed.add_field(inline=False, name=f"{pre}ar create <raider role mention or ID>",
                            value="Create anti raid system with given raider role")
            embed.add_field(inline=False, name=f"{pre}ar no", value="Turn off the anti raid alarm if it's on.")
            embed.add_field(inline=False, name=f"{pre}ar raid", value="Turn on the anti raid alarm if it's off.")
            embed.add_field(inline=False, name=f"{pre}ar kick (True or False)",
                            value="Kick all members inside the anti raid cell and pass in whether or not "
                                  "to switch off the anti raid alarm. Default is no.")
            embed.add_field(inline=False, name=f"{pre}ar ban (True or False)",
                            value="Ban all members inside the anti raid cell and pass in whether or not to"
                                  " switch off the anti raid alarm. Default is yes.")
            embed.add_field(inline=False, name=f"{pre}ar cell", value="Show anti raid cell status.")
            embed.add_field(inline=False, name=f"{pre}ar + <member mention or ID>",
                            value="Add the target into the anti raid cell.")
            embed.add_field(inline=False, name=f"{pre}ar - <user mention or ID>",
                            value="Remove the target from the anti raid cell if they are in it.")
            embed.add_field(inline=False, name=f"{pre}ar s", value="Bring up anti raid setting menu")
            await ctx.send(embed=embed)
    async def verify(self, ctx: commands.Context):
        """
        Async function that checks whether or not a server have anti-raid system.

        Args:
            ctx(commands.Context): passing in context for reply

        Returns:
            None
        """
        try:
            data = self.logging[ctx.guild.id]
        except KeyError:
            pre = prefix(self, ctx)
            await ctx.send(f"This server have not setup an anti-raid yet. Do `{pre}antiraid create <raider role>`"
                           f"to set it up.")
            return
        return data
Exemple #5
0
    async def role_menu(self, ctx: commands.Context):
        """
        Command for RoleMenu class and group of role_menu commands. Will reply with correct sub-command usage if none
        or wrong sub-command is provided.

        Args:
            ctx(commands.Context): pass in context for reply

        Returns:
            None
        """
        if not ctx.invoked_subcommand:
            pre = prefix(self, ctx)

            embed = discord.Embed(title="`Role Menu` Command", colour=0x81ecec)
            embed.add_field(
                inline=False,
                name=f"{pre}rm l (Menu Name)",
                value=
                "List the menu in the server or about the mentioned role menu")
            embed.add_field(inline=False,
                            name=f"{pre}rm c (new Menu Name)",
                            value="Create a new role menu")
            embed.add_field(
                inline=False,
                name=f"{pre}rm + <menu name> <role mention or ID>",
                value="Add specified role to the mentioned role menu")
            embed.add_field(
                inline=False,
                name=f"{pre}rm - <menu name> <emote/ID or role mention/ID>",
                value="Remove the emote or role from the mentioned menu")
            embed.add_field(
                inline=False,
                name=f"{pre}rm r <menu name>",
                value="Attempt to resolve any potential issue in that role menu"
            )
            embed.add_field(inline=False,
                            name=f"{pre}rm p <menu name>",
                            value="Remove the role menu")
            embed.add_field(
                inline=False,
                name=
                f"{pre}rm s <menu name> <message ID> channel mention or ID)",
                value=
                "Set the target message to the target message, if no channel mention, then will "
                "attempt to scan the current channel for the message")
            embed.add_field(inline=False,
                            name=f"{pre}rm toggle <menu name>",
                            value="Turn the mentioned role menu on or off")
            embed.add_field(
                inline=False,
                name=f"{pre}rm m <menu name>",
                value=
                "Switch the mentioned menu's mode between single or multiple")
            embed.add_field(
                inline=False,
                name=f"{pre}rm emote <menu name>",
                value=
                "Add all the reactions onto the target message for that mentioned menu"
            )
            embed.add_field(
                inline=False,
                name=f"{pre}rm clear <menu name>",
                value=
                "Clear all the reactions on the target message for that mentioned menu"
            )

            await ctx.send(embed=embed)