【发布时间】:2019-02-11 09:08:25
【问题描述】:
bot = commands.Bot(command_prefix='#')
@bot.event
async def on_message(message):
if message.content == "detect":
await bot.send_message(message.channel, "detected")
这是我通过 python 制作 discord bot 的代码(已跳过),我想检测“检测”这个词 我成功地检测到了那个词,但它无法检测到其他字母什么时候在那个词的前面或后面。 (例如一些检测到的东西)
即使有一些其他字母,是否有任何解决方案来检测“检测”这个词?
【问题讨论】:
-
你试过了吗:如果message.content中的“检测”:
-
请注意,
"detect" in "undetectable"是True,这可能是也可能不是您想要的,尤其是当您提到“单词”时。