• Sends a message to a specified channel in Discord.

    Parameters

    • token: string

      The token used for authentication with the Discord API.

    • channelId: string

      The ID of the channel to which the message will be sent.

    • body: any

      The content of the message to be sent.

    Returns Promise<Message<boolean>>

    A promise that resolves to the sent Message object.

    Throws

    Will throw an error if there is a problem sending the message.

    Example

    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