簡體   English   中英

為我的 Discord.py 機器人創建自動幫助命令

[英]Making an automatic help command for my Discord.py bot

我將如何自動獲取用法和描述

@bot.command(usage='ping', desc='gets bots latency')

我嘗試get_command() commands all_commands但它們沒有返回任何內容。 我再次嘗試使用 cog help 命令,但仍然無法工作。 有人能幫忙嗎?

不要使用 Discord 的默認幫助命令,而是使用client.remove_command('help') 這只是從您的機器人中刪除了默認命令“幫助”。 這樣,您現在可以替換並制作自己的,但您必須手動添加它們。

我還建議使用嵌入,因為這也有助於使命令看起來更清晰並組織每個命令的顯示。

@client.command()
async def help(ctx):

    embed = discord.Embed(colour=0x7289DA, timestamp=ctx.message.created_at)
    embed.add_field(name='Help commands', value='Please refer to the commands listed below for commands available for use', inline=True)

    embed.add_field(name='command name', value='details about this command', inline=True)                                       
    embed.set_footer(text=f"Help commands")
    await ctx.send(embed=embed)

嘿親愛的真的很容易..你只需要寫這個:-

@bot.command(usage='ping', desc='獲取機器人延遲', help='獲取機器人延遲。')

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM