OokamiPupV2/cmd_discord/help.py

31 lines
1.1 KiB
Python

# cmd_discord/help.py
import discord
from discord.ext import commands
from discord import app_commands
from typing import Optional
from modules.utility import handle_help_command
import globals
class HelpCog(commands.Cog):
"""Handles the !help and /help commands."""
def __init__(self, bot):
self.bot = bot
self.primary_guild = globals.constants.primary_discord_guild()
@commands.command(name="help")
async def cmd_help_text(self, ctx, *, command: str = ""):
"""Handles text-based help command."""
result = await handle_help_command(ctx, command, self.bot, is_discord=True)
await ctx.reply(result)
@app_commands.command(name="help", description="Get information about commands")
async def cmd_help_slash(self, interaction: discord.Interaction, command: Optional[str] = ""):
"""Handles slash command for help."""
result = await handle_help_command(interaction, command, self.bot, is_discord=True)
await interaction.response.send_message(result)
async def setup(bot):
await bot.add_cog(HelpCog(bot))