尝试提出建议,但频道 ID 给出了命令错误

Trying to make a suggestion but channel id gives an error for the command

我遇到了一个问题,但我没有收到任何错误,我刚刚编写的代码如下所示

@client.commands
async def hello():
    channel = int(797915093954199565)
    await channel.send('Hey what are you doing?')

我正在尝试发出一个命令,用户可以在其中与机器人对话,它会回复一些东西,这只是一个开始命令,但我在处理这些小问题时遇到了问题,机器人的其余部分可以正常工作但我遇到的只是这个问题,请帮忙!

所以假设您的机器人和代码的其余部分工作正常,您的“hello”命令不起作用,因为您有

@client.commands  #its client.command in this case, as it seems you are not using any cogs, and you must call the client with () these double parentheses 
async def hello():     #Here you have not passed ctx
    channel = int(793744805615632394)   #It seems what you would like to do here is send it to a specific channel, however, in the code below, I have set it so it just sends to the channel it was used in. The correct use is client.get_channel(793744805615632394)
    await channel.send('Hey what are you doing?')

这是命令但已修复:

所以假设您的机器人和代码的其余部分工作正常,您的“hello”命令不起作用,因为您有

@client.command()
async def hello(ctx):
    await ctx.send('Hey what are you doing?')

您还应该参考 py 文档以了解更多信息:https://discordpy.readthedocs.io/en/latest/