I’m developing a Discord bot and attempting to utilize the .sendMessage method to send a message. I want to avoid the bot sending a message automatically when I type, so I’m not utilizing bot.on('message', function(message) {});
. However, I’m encountering an error stating that .sendMessage is not a function. Here’s my current code:
const Discord = require('discord.js');
const BotToken = 'your-token-here';
const bot = new Discord.Client();
bot.login(BotToken);
bot.sendMessage('your-server-id', 'Hello, world!');
I have installed discord.js using npm, assuming it was included in the package. Additionally, I’ve tried using .setStreaming, but it produces a similar error. I’ve followed the installation instructions from the discord.js documentation. Can someone help me identify what I might be overlooking?