English 中文(简体)
Create Schedule Events - Discord.js V14.13.0 - Error [GuildVoiceChannelResolve]
原标题:

Trying to create a external schedule event. Here is my function that causes the error.

Error [GuildVoiceChannelResolve]: Could not resolve channel to a guild voice channel

async function handleWordPressEvent(client, eventData) {
    console.log("Handling WordPress event:", eventData);

    const guild = client.guilds.cache.get(process.env.GUILD_ID);
    if (!guild) {
        console.error("Guild not found");
        return;
    }

    // Create an external event
    try {
        const event = await guild.scheduledEvents.create({
            name: eventData.title,
            description:  Event powered by the Trade the Fund calendar. ,
            startAt: new Date(eventData.start_date),
            endAt: new Date(eventData.end_date),
            entityType:  EXTERNAL ,
            privacyLevel:  GUILD_ONLY ,
            location: eventData.link,
            coverImage: eventData.cover_image,
        });

        console.log(`Created a new external event with ID: ${event.id}`);
    } catch (error) {
        console.error("Error creating the external event:", error);
    }
}

I don t want a channel id and want to keep it external. so tried setting channel and channelId to null but didn t seem to work.

            const event = await guild.scheduledEvents.create({
                channel: null, // Try explicitly setting this to null
                channelId: null, // Explicitly set this to null
                name:  Sample Event ,
                description:  A sample description for our event. ,
                scheduledStartTime: new Date(),
                privacyLevel:  GUILD_ONLY ,
                entityType:  EXTERNAL 
            });

any help would be awesome!

问题回答

暂无回答




相关问题
How can I make my bot works in multiple servers?

I know that this question has been asked for discord.py, but couldn t find a discord.js one Currently I m working on a small Discord Bot, and I would like to make it with possible that it can be used ...

Discord.js not recognizing file path as directory

I am trying to learn how to use the / command system in Discord.js, however, following the Discord.js guide results in the following error: Error: ENOTDIR: not a directory, scandir This is with the ...

Discord bot responds multiple times for one event

I want my bot to respond once to a command such as .on. However, it responds multiple times per input: The code is: client.on( message , message =>{ if(message.content === .on ){ ...

热门标签