client.sendMessage prodces the error: "TypeError: client.sendMessage is not a function"
Code:
const Discord = require('discord.js');
const client = new Discord.Client();
var ffmpeg = require('ffmpeg');
const playArbitraryFFmpeg = require('discord.js-arbitrary-ffmpeg');
let prefix = "!";
Stat = "online"
Game = "Prefix - '!'"
client.on('ready', () => {
client.user.setStatus("online"); //Reminder: dnd (Do Not Disturb), online (Online), idle (Idle)
client.user.setGame("Prefix - '!'");
console.log("Client Is Online!");
console.log("Client Prefix: " + "'" + prefix + "'" )
console.log("Status: " + Stat)
});
client.login('TOKEN HERE', output);
function output(error, token) {
if (error) {
console.log(There was an error logging in: ${error});
return;
} else
console.log(Logged in. Token: ${token});
}
client.on('message', function(message) {
if (message.content == "!hi"){
client.sendMessage(message.channel, "Hello!");
}
});
so uh I think you should edit out that token
and make sure to renew it
Yeah I just realised, Thanks
Anyway, you should ask this kind of question on the discord, it's pretty much telling you to. See the link, it's probably at the README.
But basically, it's .send and not .sendMessage
Oh ok, Thanks but it still says it's not a function
You can't send a message to the client
@GummiWummiBear good spot, I didn't even realize he wrote client instead of channel 馃
client.sendMessage() hasn't been a thing since v9, for reference d.js is on v11.2 in stable... You must be looking at outdated information. It is msg.channel.send(content[, options]) now.
Oh, Ok then. Thanks for the help everyone! I'll try it now
Yeah, It Works. Thanks Everyone!
Most helpful comment
Yeah, It Works. Thanks Everyone!