'Discord selfbot - answering on messages from everyone
I have Discord selfbot in node.js and I wanna make a bot answering to massages from other server members, for example, if someone type "hey" selfbot will send into DMs "I'm busy rn, sorry"
I have this code but it is not working, I did not get any error but it is not working :(
client.on('message', message => {
if (message.content.startsWith('hey'))
target.send('im afk')
})
Solution 1:[1]
client.on('message', message => {
if (message.content.startsWith('idk'))
message.channel.send("Im Afk");
})
The message has to start with 'idk' so that this is triggered.
Solution 2:[2]
client.on('message', message => {
console.log('Message received: ' + message.content);
if(message.content === 'hey') {
message.author.send("Im busy rn, sorry!");
}
});
Try outputting the console output to double check that the message content is actually received properly. Also try using message.content === '' (however this will only work if the whole message content is 'hey')
Solution 3:[3]
Actually you can do that
client.on('message', message => {
if(message.content.startsWith('')) {
message.channel.send("im AFK");
}
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ghonima |
| Solution 2 | |
| Solution 3 | Sans |
