Answer the question
In order to leave comments, you need to log in
How to redirect a bot from a response with a link to a response without a link?
I am writing a bot for Discord on discord.js.
There is a code. What would the bot respond to when users write a message to the chat.
So, when answering, he mentions this person. Well, this is understandable because there is a message.reply in the code
And how to make it so that it does not answer, but sends a message?
Here is the code:
client.on("message", (message) => {
if(message.content == "Привет всем"){
message.reply("Привет! :wave:");
}
});
Answer the question
In order to leave comments, you need to log in
If you ask a question, you write what you use. If I didn't know that you are trying to write a Discord bot using discord.js, I would never understand the question. And believe me, answering your question becomes many times more difficult.
In your case: The Message
object has a channel variable that is equal to the TextChannel object into which the message was sent. This object has a .send() method with which you can send a message to this text channel.
Final code:
client.on("message", (message) => {
if(message.content == "Привет всем"){
message.channel.send("Привет! :wave:");
}
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question