Skip to content

Commit 392c024

Browse files
committed
Add help command to provide a list of available commands
1 parent 7a12106 commit 392c024

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

cogs/general.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,19 @@ async def info(self, interaction: discord.Interaction):
2525
embed.set_footer(text="Made with love by @yusuf.md")
2626
await interaction.response.send_message(embed=embed)
2727

28+
@app_commands.command(name='help', description="Provides a list of all commands and their descriptions")
29+
async def help(self, interaction: discord.Interaction):
30+
embed = discord.Embed(title="Help", color=discord.Color.blue())
31+
32+
excluded_commands = ['sync', 'reload', 'purge', 'kick', 'ban', 'mute', 'unmute', 'warn']
33+
34+
for cog in self.bot.cogs.values():
35+
for command in cog.get_app_commands():
36+
if command.name not in excluded_commands:
37+
embed.add_field(name=command.name, value=command.description, inline=True)
38+
39+
await interaction.response.send_message(embed=embed)
40+
2841
def get_uptime(self):
2942
since = self.bot.start_time
3043
now = datetime.datetime.now()

0 commit comments

Comments
 (0)