Python message.content discord bot

Python message.content discord bot,python,python-requests,bots,discord,discord.py,Python,Python Requests,Bots,Discord,Discord.py,我想要一个帮助,我试图使我的机器人在不和谐的自动响应时,有人写一些字,问题是,该命令只有在字是第一件事写在句子中。我希望我的机器人可以回应这个消息,即使这个词在某个句子的中间。 我该怎么办 Bot = commands.Bot(command_prefix="") @Bot.event async def on_message(message): if "not" in message.content: await Bot.send_message(mess

我想要一个帮助,我试图使我的机器人在不和谐的自动响应时,有人写一些字,问题是,该命令只有在字是第一件事写在句子中。我希望我的机器人可以回应这个消息,即使这个词在某个句子的中间。 我该怎么办

Bot = commands.Bot(command_prefix="")

@Bot.event

async def on_message(message):

     if "not" in message.content:
           await Bot.send_message(message.channel, 'yes')

要澄清-
message.content.startswith
将只检查定义的字符/字符串是否位于消息的开头,而message.content将扫描发送的整个消息。

main.py:

import discord

client = discord.Client()

@client.event
async def on_message:
 if message.content.startswith(‘Exemple’):
   message.channel.send(‘this is an exemple’)

client.run(os.getenv(‘TOKEN’))
TOKEN=[paste the token of the bot here]
.env:

import discord

client = discord.Client()

@client.event
async def on_message:
 if message.content.startswith(‘Exemple’):
   message.channel.send(‘this is an exemple’)

client.run(os.getenv(‘TOKEN’))
TOKEN=[paste the token of the bot here]

message.content.startswith('not')
显然只查看字符串的开头。如果message.content中的'not',请使用
,或者在消息上使用正则表达式。顺便说一句,每次有人说“不”时就触发一个机器人会很快变得很烦人……你是用discord.py还是disco?