Cogs

The cogs of this package implement some basics and utils commands: help commands, utils commands for the application's owner.

Help

A cog which implement help commands and methods to build the help message.

import discord
from discord_slash import SlashCommand
from baseDiscord import BaseBot, Help

mybot = BaseBot("my token", prefix="!", color=discord.Colour.blue(), color_error=discord.Colour.red())
slash = SlashCommand(mybot)

# Add cogs
Help.setup(bot)

Parameters

Help.__init__(self, bot: commands.Bot, max_cmd_by_page: int = 8)

Parameter

Type

Description

Required

Default

bot

The Bot instance which use the cog

✔️

max_cmd_by_page

int

The maximum of commands by help page. Used for the global help command.

8

Attributes

Attributes of discord.ext.commands.Cog +

Name

Type

Description

bot

The Bot instance which use the cog

max_cmd_by_page

int

The maximum of commands by help page. Used for the global help command.

Methods

Methods of Cog +

  • _base_embed : a method to create a base embed for help commands. This embed is created with a thumbnail.

    • Parameters

      • title : str - The title of Embed

      • (description) : str - The description of Embed

      • (author) : discord.User - author of Embed

    • Returns

The method base_embedcan be use to create an Embed with avatar of bot in thumbnail and the author of command.

  • _command_base : a method to create a base help for a command. Used for the global help command.

    • Paramters

    • Returns

      • str - The base help for the command. By default, included the description, the name and the brief of command.

  • _command_usage : a method to create an usage message for a command

  • _command_aliases : a method to create aliases message for a command.

  • _command_help_fmt : method to format the help message for a command. This method join the result of _command_base, _command_usage and _command_aliases methods.

⬆️ These methods can be overwrite to customize the help message of a command.

  • first_page : method to create the first page (embed) of global help command

    • Parameters

    • Returns : discord.Embed - embed for the first page of global help commands

To customize the first page of help command. You can overwrite the first_page method. This method must returns an Embed.

  • commands_pages : method to create the help pages (embed) for commands

    • Parameters

      • group_cmd : Union[Cog , List[Command]] - The cog or a list of commands for the help commands (it's a group of commands for a same "category").

      • (author) : discord.User - The author of command.

    • Returns : List[discord.Embed ] - The list of page (embed) for this group of commands.

To customize the structure of pages for the help command. You can overwrite the method. This method must returns a list of Embed.

Commands

Slash Commands

  • help

    • all : Show a help on all commands in an embed multi pages. This commands use first_page and commands_pages to build pages.

    • command :Get help for a scpecific command.

    • category : Get help for a category of commands

Commands which have the attribute hidden = True aren't displayed.

Owner

A cog which implement utils commands for the application's owner.

import discord
from discord_slash import SlashCommand
from baseDiscord import BaseBot, Owner

mybot = BaseBot("my token", prefix="!", color=discord.Colour.blue(), color_error=discord.Colour.red())
slash = SlashCommand(mybot)

# Add cogs
Owner.setup(bot)

Parameters

Owner.__init__(self, bot: commands.Bot)

Parameter

Type

Description

Required

Default

bot

The Bot instance which use the cog

✔️

Attributes

Attributes of discord.ext.commands.Cog +

Name

Type

Description

bot

The Bot instance which use the cog

Methods

Commands

  • stopBot : A command to disconnect the bot.

All commands of this Cog are created with attribute hidden=True

Slash Commands

Last updated

Was this helpful?