Stack Overflow Asked on November 4, 2021
I am trying to get my bot to read messages from a channel in server 1 and send the same message with some added content to a channel in server 2 and vice versa when a message is sent in server 2 in the same channel.
Right now the bot can only read one message and send it perfectly but after that the bot sends the message back to the same channel.
Here is my code below:
client.on('message', message => {
if(message.author.bot) return;
if(message.channel.id = "735085499571765288"){
var messageContent = message.content;
client.channels.get('735084968476278805').send(`A Ruse Kid Said: ${messageContent}`);
}
});
client.on('message', message => {
if(message.author.bot) return;
if(message.channel.id === "735084968476278805"){
var messageContent = message.content;
client.channels.get('735085499571765288').send(`A High Kid Said: ${messageContent}`)
}
});
Any help or advice appreciated. Thanks for your time.
By using:
if (message.channel.id = "735085499571765288") {
You are actually assigning "735085499571765288"
to message.channel.id
.
If you want to check for equality, you have to use at least two =
:
if (message.channel.id === "735085499571765288") {
Answered by Erazihel on November 4, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP