【问题标题】:Discord bot Help commandDiscord 机器人帮助命令
【发布时间】:2018-05-06 14:19:44
【问题描述】:

因此,当人们使用 discord.py 附带的帮助命令时,我正在尝试更改命令的描述。

但我似乎真的不知道如何或在何处放置此描述。

我也在尝试在帮助列表中创建不同的类别,例如音乐,但我真的不知道从哪里开始。

我对 python 很陌生,但我之前接触过其他编程语言

我的代码很长,但这是其中的一部分

client = commands.Bot(command_prefix=commands.when_mentioned_or('?'), 
description='Help List', pm_help = True)
client.add_cog(Music(client))

path = 'Blacklist.txt'

bl = open(path, 'r')

@client.event
async def on_ready():
    print('---------------------------------------------------------------------------------------')
    print('')
    print('Logged in as '+client.user.name+' (ID:'+client.user.id+') | Connected to '+str(len(client.servers))+' servers | Connected to '+str(len(set(client.get_all_members())))+' users')
    print('')
    print('---------------------------------------------------------------------------------------')
    print('')
    print('Current Discord.py Version: {} | Current Python Version: {}'.format(discord.__version__, platform.python_version()))
    print('')
    print('---------------------------------------------------------------------------------------')

@client.command()
async def ping(*args):
    await client.say(":ping_pong: Pong!")

假设我想为 ping 命令添加描述。我究竟会在哪里以及如何做到这一点?

【问题讨论】:

    标签: python bots discord


    【解决方案1】:
    @client.command(description="Some ping command") #here
    async def ping(*args):
        await client.say(":ping_pong: Pong!")
    

    【讨论】:

      【解决方案2】:
      @client.command()
      async def ping(*args):
          "here"
          await client.say(":ping_pong: Pong!")
      

      【讨论】:

        猜你喜欢
        • 2021-01-01
        • 1970-01-01
        • 2018-05-31
        • 2021-10-06
        • 2021-08-14
        • 2019-12-14
        • 2018-12-12
        • 2021-08-13
        • 2020-07-08
        相关资源
        最近更新 更多