Discord.py:消息未发送到频道

时间:2021-06-06 19:37:05

标签: python python-3.x discord.py

我有一个命令,让用户下订单,当下订单时,它会向特定频道发送订单消息。现在,我在我的 main.py 文件中完成了这项工作,但这是在一个齿轮中,我遇到了一些问题。我不明白这里的问题是什么。

await client.wait_until_ready()
channel = ctx.client.get_channel(851150407849213992)
await channel.send(order) # order is already defined previously

2 个答案:

答案 0 :(得分:1)

ctx.client.get_channel替换self.client.get_channel

答案 1 :(得分:0)

由于这是一个齿轮,您必须包含 self 这是如何修复它的代码

await client.wait_until_ready()
channel = self.client.get_channel(851150407849213992)
await channel.send(order) # order is already defined previously