Michel Migalov
Michel Migalov
DIdiscord.js - Imagine ❄
Created by Michel Migalov on 12/11/2024 in #djs-questions
Drop-down lists inside modal windows
Hurtful. I hope this will be fixed in future updates.
3 replies
DIdiscord.js - Imagine ❄
Created by Michel Migalov on 12/11/2024 in #djs-questions
Creating an event via a bot.
It's working! Thank you very much! I thought it was impossible to create such a thing.
9 replies
DIdiscord.js - Imagine ❄
Created by Michel Migalov on 12/11/2024 in #djs-questions
Creating an event via a bot.
const { clientId, guildId, token } = require("../../config.json");
const { SlashCommandBuilder, GuildScheduledEventEntityType, GuildScheduledEventPrivacyLevel } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('event')
.setDescription('a test command'),

async execute(interaction) {

const guild = interaction.client.guilds.cache.get(guildId);

if (!guild) return console.log('Guild not found');

const eventOptions = {
name: 'My Event',
scheduledStartTime: new Date('2025-10-01T12:00:00Z'),
scheduledEndTime: new Date('2025-10-01T13:00:00Z'),
description: 'This is a test event.',
entityType: GuildScheduledEventEntityType.Voice,
privacyLevel: GuildScheduledEventPrivacyLevel.GuildOnly,
};

try {
const scheduledEvent = await guild.scheduledEvents.create(eventOptions);
console.log(`Event created: ${scheduledEvent.name}`);
} catch (error) {
console.error('Error creating event:', error);
}
},
};
const { clientId, guildId, token } = require("../../config.json");
const { SlashCommandBuilder, GuildScheduledEventEntityType, GuildScheduledEventPrivacyLevel } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('event')
.setDescription('a test command'),

async execute(interaction) {

const guild = interaction.client.guilds.cache.get(guildId);

if (!guild) return console.log('Guild not found');

const eventOptions = {
name: 'My Event',
scheduledStartTime: new Date('2025-10-01T12:00:00Z'),
scheduledEndTime: new Date('2025-10-01T13:00:00Z'),
description: 'This is a test event.',
entityType: GuildScheduledEventEntityType.Voice,
privacyLevel: GuildScheduledEventPrivacyLevel.GuildOnly,
};

try {
const scheduledEvent = await guild.scheduledEvents.create(eventOptions);
console.log(`Event created: ${scheduledEvent.name}`);
} catch (error) {
console.error('Error creating event:', error);
}
},
};
Error creating event: Error [GuildVoiceChannelResolve]: Could not resolve channel to a guild voice channel.
Error creating event: Error [GuildVoiceChannelResolve]: Could not resolve channel to a guild voice channel.
It is not very clear how to arrange the entered values.
9 replies