-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Improved ``!help`` command by replacing it with ``discord.Embed`` (#17)
- Loading branch information
Dennis Jabs
committed
Sep 16, 2024
1 parent
3ce6f88
commit 0b4f8ad
Showing
5 changed files
with
97 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
from discord_bot.command.music import Music, MusicState | ||
from discord_bot.command.help import Help | ||
from discord_bot.command.music import Music | ||
|
||
del help # type: ignore[name-defined] # noqa: F821 | ||
del music # type: ignore[name-defined] # noqa: F821 | ||
|
||
__all__ = [ | ||
"Help", | ||
"Music", | ||
"MusicState", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from discord.ext import commands | ||
|
||
|
||
class Help(commands.HelpCommand): | ||
"""To display help information for all cogs and commands.""" | ||
|
||
async def send_bot_help( | ||
self, mapping: dict[commands.Cog | None, list[commands.Command]] | ||
): | ||
""" | ||
Sends the help message for the bot. | ||
Args: | ||
mapping (dict[commands.Cog | None, list[commands.Command]]): | ||
A dictionary containing all cogs and commands. | ||
""" | ||
# Send the embed | ||
channel = self.get_destination() | ||
|
||
# Iterate through all cogs and commands | ||
for cog, _ in mapping.items(): | ||
if cog is not None: | ||
embed = cog.help_information() | ||
await channel.send(embed=embed) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters