即使单词的前面或后面有一些字母,也能检测出特定的单词吗?(Python)

2024-04-25 11:56:21 发布

您现在位置:Python中文网/ 问答频道 /正文

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的代码(跳过),我想检测“detect”这个词 我成功地检测到了那个单词,但它无法检测出该单词前面或后面是否有其他字母。 (例如,某种东西)

有没有什么方法可以检测出“detect”这个词,即使还有其他字母?你知道吗


Tags: eventmessageasyncprefixifondefbot