Create Events

client.on('ready', async () => {
let c = await client.guilds.fetch("467433493261975563")

let eventName = {
name: "test",
scheduled_start_time: new Date('August 10, 2022 03:24:00'),
description: "testing yo",
channel_id: "1005915518739431604",
entity_type: "2",
privacy_level: 2,
image: "URL",
}

c.scheduledEvents.create(eventName)
})
client.on('ready', async () => {
let c = await client.guilds.fetch("467433493261975563")

let eventName = {
name: "test",
scheduled_start_time: new Date('August 10, 2022 03:24:00'),
description: "testing yo",
channel_id: "1005915518739431604",
entity_type: "2",
privacy_level: 2,
image: "URL",
}

c.scheduledEvents.create(eventName)
})
Errors out:
/home/ubuntu/discord/node_modules/discord.js/src/managers/GuildScheduledEventManager.js:93
if (!channel_id) throw new Error('GUILD_VOICE_CHANNEL_RESOLVE');
^

Error [GUILD_VOICE_CHANNEL_RESOLVE]: Could not resolve channel to a guild voice channel.
at GuildScheduledEventManager.create (/home/ubuntu/discord/node_modules/discord.js/src/managers/GuildScheduledEventManager.js:93:30)
at Client.<anonymous> (/home/ubuntu/discord/schedules/mondaymovies.js:28:23)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
[Symbol(code)]: 'GUILD_VOICE_CHANNEL_RESOLVE'
}
/home/ubuntu/discord/node_modules/discord.js/src/managers/GuildScheduledEventManager.js:93
if (!channel_id) throw new Error('GUILD_VOICE_CHANNEL_RESOLVE');
^

Error [GUILD_VOICE_CHANNEL_RESOLVE]: Could not resolve channel to a guild voice channel.
at GuildScheduledEventManager.create (/home/ubuntu/discord/node_modules/discord.js/src/managers/GuildScheduledEventManager.js:93:30)
at Client.<anonymous> (/home/ubuntu/discord/schedules/mondaymovies.js:28:23)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
[Symbol(code)]: 'GUILD_VOICE_CHANNEL_RESOLVE'
}
7 Replies
d.js docs
d.js docs3y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
Mulo
MuloOP3y ago
const client = new Client({ intents: [Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_VOICE_STATES, Intents.FLAGS.GUILD_PRESENCES] });
const client = new Client({ intents: [Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_VOICE_STATES, Intents.FLAGS.GUILD_PRESENCES] });
the bot is admin so can see everything the channel is voice channel:
entity_type: "2",
entity_type: "2",
Mulo
MuloOP3y ago
d.js docs
d.js docs3y ago
interface GuildScheduledEventCreateOptions Options used to create a guild scheduled event.
Mulo
MuloOP3y ago
ye that says like scheduledStartTime https://discord.com/developers says scheduled_start_time is very confusing
Almeida
Almeida3y ago
you have to use camelCase options channelId, scheduledStartTime, etc half of the messages were missing on my end, dumb forum channels 🤕
Mulo
MuloOP3y ago
how can i close the process process.exit only after a completed promise? in this case after the event is created
Want results from more Discord servers?
Add your server