更新时间:2023-11-19 11:46:52
消息
类包含有关消息的 author
,您可以利用它来确定是否响应消息。 author
是 成员
对象(或其超类 用户
(如果频道是私有的),它具有 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)
应根据需要运行