更新时间:2023-11-19 11:34:04
message
类包含有关消息的 author
,您可以使用它来确定是否回复消息.作者
是 会员
对象(或其超类 User
如果频道是私有的),它具有 id
属性,但也支持用户之间的直接逻辑比较.
The message
class contains information on the message's author
, which you can utilize to determine whether or not to respond to the message. author
is a Member
object (or its superclass User
if the channel is private), which has an id
property but also supports direct logical comparisons between users.
例如:
@bot.event
async def on_message(message):
if message.author != bot.user:
await bot.send_message(message.channel, message.content)
应该按需要发挥作用