You have an error in your .send()
line. The current code that you have was used in an earlier version of the discord.js library, and the method to achieve this has been changed.
If you have a message object, such as in a message
event handler, you can send a message to the channel of the message object like so:
message.channel.send("My Message");
An example of that from a message
event handler:
client.on("message", function(message) {
message.channel.send("My Message");
});
You can also send a message to a specific channel, which you can do by first getting the channel using its ID, then sending a message to it:
(using async/await)
const channel = await client.channels.fetch(channelID);
channel.send("My Message");
(using Promise
callbacks)
client.channels.fetch(channelID).then(channel => {
channel.send("My Message");
});
Works as of Discord.js version 12
console.log("test")
and put it inside the if statement and check the console for the output – hansTheFranzmessage.channel.send("Something")
– Wright