discord.py 重写帮助命令

discord.py rewrite help command

有没有人有 idea/sources 我可以找到帮助命令的方法,例如: 我添加了一个名为 command1 的命令,然后一旦我重新启动机器人,它就会将它添加到帮助命令中,但是如果我将它设置为隐藏,它就不会显示

你好,我以前遇到过这个问题,所有的 discord 机器人都内置了一个帮助命令,你需要使用这行代码删除预构建的,然后让你自己的帮助命令:

@bot.command()
async def help(ctx):
    await ctx.send("Here are all my commands\nhelp - shows this")
    # or make an embed (https://codepen.io/orels/full/egZyxq) auto embed maker

一切都放在一起:

import discord
from discord.ext import commands

client = commands.Bot(command_prefix=".")
bot.remove_command("help")

@bot.command()
async def help(ctx):
    await ctx.send("Here are all my commands\nhelp - shows this")
    # or make an embed (https://codepen.io/orels/full/egZyxq) auto embed 

client.run("TOKEN GOS HERE!")

您需要添加:

bot.remove_command('help')

这是必需的,因为机器人有内置的帮助命令。

如果您使用的是“客户端”

client.remove_command("help")

async def help(ctx):
   await ctx.send("type text here")

如果您使用的是“机器人”

bot.remove_command("help")

async def help(ctx):
   await ctx.send("type text here")