37 lines
1.5 KiB
Python
37 lines
1.5 KiB
Python
# cmd_discord/howl.py
|
|
from discord.ext import commands
|
|
import discord
|
|
from discord import app_commands
|
|
from typing import Optional
|
|
import cmd_common.common_commands as cc
|
|
import globals
|
|
|
|
# Retrieve primary guild info if needed (for logging or other purposes)
|
|
primary_guild = globals.constants.primary_discord_guild() # e.g., {"object": discord.Object(id=1234567890), "id": 1234567890}
|
|
|
|
def setup(bot):
|
|
"""
|
|
Registers the '!help' command for Discord.
|
|
"""
|
|
@bot.command(name="help")
|
|
async def cmd_help_text(ctx, *, command: str = ""):
|
|
"""
|
|
Get help information about commands.
|
|
|
|
Usage:
|
|
- !help
|
|
-> Provides a list of all commands with brief descriptions.
|
|
- !help <command>
|
|
-> Provides detailed help information for the specified command.
|
|
"""
|
|
result = await cc.handle_help_command(ctx, command, bot, is_discord=True)
|
|
await ctx.reply(result)
|
|
|
|
# -------------------------------------------------------------------------
|
|
# SLASH COMMAND: help
|
|
# -------------------------------------------------------------------------
|
|
@bot.tree.command(name="help", description="Get information about commands", guild=primary_guild["object"])
|
|
@app_commands.describe(command="The command to get help info about. Defaults to 'help'")
|
|
async def cmd_help_slash(interaction: discord.Interaction, command: Optional[str] = ""):
|
|
result = await cc.handle_help_command(interaction, command, bot, is_discord=True)
|
|
await interaction.response.send_message(result) |