我搜索了很多 StackOverflow 的答案和 YouTube 视频,但我现在很困惑。
有什么办法可以删除默认的帮助命令并用COGS中的自定义命令替换它?
顺便说一下,这是我的代码。
import discord
from discord.ext import commands
class Help(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_ready(self):
print('Help is Ready')
#help cmd
@commands.group(invoke_without_command=True)
async def help(self, ctx):
em1 = discord.Embed(title = 'Help',
description = 'Commands to get you started!')
em1.add_field(name='Fun', value = 'Commands that everyone can use for fun!', inline = False)
em1.add_field(name = 'Moderation', value = 'Moderation commands to manage your server!', inline = False)
em1.add_field(name = 'Math', value ='Math commands to help you calculate stuff.')
@help.command(aliases = ['Fun'])
async def fun(self, ctx):
fun_em = discord.Embed(title = 'Fun Commands', colour = discord.Colour.dark_teal())
fun_em.add_field(name = 'slap', value = 'Slap someone if you are angry!\n\nUsage: -slap <Mention the user you want to Slap>', inline = False)
fun_em.add_field(name = '8ball', value = 'A random answer to your Question.\n\nUsage: -8ball <Your Question here.>', inline = False)
await ctx.send(embed=fun_em)
def setup(bot):
bot.add_cog(Help(bot))
我尝试在 main.py 中执行 bot.remove_command('help')
但这只是完全删除了 help 命令。我想换一个新的。
请详细解释一下,因为我是 discord.py 的新手。