Answer the question
In order to leave comments, you need to log in
Discord Bot, how to teach a bot to see a word in a message?
Good afternoon, I want to make the bot write a certain phrase if the message of any user contains a certain word. If the message starts with this word, then everything works.
client.on("message", (message) => {
if (message.content.startsWith("слово")) {
message.channel.send("ответ!");
}
});
client.on("message", (message) => {
if (message.content.contains("кс")) {
message.channel.send("кс не будет");
}
});
Answer the question
In order to leave comments, you need to log in
Here is the code:
import discord
client = discord.Client()
greeting = ('привет', 'пр', 'hello', 'hi', 'q', 'qq', 'privet')
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith( greeting ):
await message.channel.send('Привет')
client.run()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question