Cogs
The cogs of this package implement some basics and utils commands: help commands, utils commands for the application's owner.
Help
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
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
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
embed
: discord.Embed - the embed instance
_command_base
: a method to create a base help for a command. Used for the global help command.Paramters
cmd
: discord.ext.commands.Command - The command
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 commandParameters
cmd
: discord.ext.commands.Command - The command
Returns : str - usage of the command if it's exist else an empty string.
_command_aliases
: a method to create aliases message for a command.Parameters
cmd
: discord.ext.commands.Command - The command
Returns : str - aliases of the command if it's exist else an empty string.
_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.Parameters
cmd
: discord.ext.commands.Command - The command
Returns : str - The help message for the command
first_page
: method to create the first page (embed) of global help commandParameters
(author) : discord.User - The author of command
Returns : discord.Embed - embed for the first page of global help commands
commands_pages
: method to create the help pages (embed) for commandsParameters
(author) : discord.User - The author of command.
Returns : List[discord.Embed ] - The list of page (embed) for this group of commands.
Commands
There is not commands
Slash Commands
help
all
: Show a help on all commands in an embed multi pages. This commands usefirst_page
andcommands_pages to build pages.
command
:
Get help for a scpecific command.category
: Get help for a category of commands
You shouldn't overwrite the method which implement this command.
Subcommands command
and category
are not implemented.
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
Attributes
Attributes of discord.ext.commands.Cog
+
Name
Type
Description
Methods
Commands
stopBot
: A command to disconnect the bot.
Slash Commands
There is not slash commands
Last updated
Was this helpful?