The token used for authentication with the Discord API.
The ID of the channel to which the message will be sent.
The content of the message to be sent.
A promise that resolves to the sent Message object.
Will throw an error if there is a problem sending the message.
const token = 'your_discord_token_here';
const channelId = 'your_channel_id_here';
const body = {
content: 'Hello, world!',
};
const run = async () => {
try {
const message = await messageChannel(token, channelId, body);
console.log(`Message sent with ID: ${message.id}`);
} catch (error) {
console.error(`Error: ${error.message}`);
}
}
run();
Generated using TypeDoc
Sends a message to a specified channel in Discord.