【发布时间】:2018-08-13 19:54:56
【问题描述】:
我试图让我的discord.py 机器人在有人发送某个单词时自动响应,但问题是该命令仅在单词是句子中要写的第一件事时才有效。即使单词在某个句子的中间,我也希望我的机器人响应消息。如果可以,我该怎么做?
【问题讨论】:
-
message.content.startswith('not')显然只查看字符串的开头。在消息上使用if 'not' in message.content或正则表达式。顺便说一句,每次有人说“不”时触发一个机器人会很快变得非常烦人...... -
你使用的是 discord.py 还是 disco?
标签: python discord discord.py bots