【发布时间】:2021-08-04 00:20:20
【问题描述】:
所以我正在尝试使用 discord,.py 制作一个不和谐的机器人,并且我希望机器人在有人发送包含特定字符串的消息时说些什么。这就是我想要发生的事情
@client.event
async def on_message(msg):
if 'i' in msg:
channel = client.get_channel("742261026686500896")
await channel.send("i")
我收到这个错误
TypeError: argument of type 'Message' is not iterable
我该怎么做呢?
【问题讨论】:
-
msg是一个具有多个属性的对象。文本部分位于msg.content。
标签: python discord discord.py