scheduledEvents

Hello, I'm trying to do a command that show event available on a discord server. Here the code :
const { MessageEmbed } = require('discord.js');
const fs = require('fs');

module.exports = {
name: 'eventlist',
description: 'Affiche les événements d\'un serveur',

async run(client, message, args) {
const guildEvents = message.guild.scheduledEvents;
console.log(guildEvents)

// Vérifie s'il y a des événements
if (guildEvents && guildEvents.length > 0) {
// Crée un embed pour afficher les événements
const embed = new MessageEmbed()
.setTitle(`Événements du Serveur`)
.setColor('#0099ff');

guildEvents.forEach((event, index) => {
embed.addField(`Événement #${index + 1}`,
`**Titre/Nom:** ${event.title}\n` +
`**Début:** ${event.start}\n` +
`**Lieu:** ${event.location}\n` +
(event.image ? `**Image:** ${event.image}` : '')
);
});

// Envoie l'embed dans le canal où la commande a été utilisée
message.channel.send({ embeds: [embed] });
} else {
message.channel.send('Aucun événement trouvé pour ce serveur.');
}
}
};
const { MessageEmbed } = require('discord.js');
const fs = require('fs');

module.exports = {
name: 'eventlist',
description: 'Affiche les événements d\'un serveur',

async run(client, message, args) {
const guildEvents = message.guild.scheduledEvents;
console.log(guildEvents)

// Vérifie s'il y a des événements
if (guildEvents && guildEvents.length > 0) {
// Crée un embed pour afficher les événements
const embed = new MessageEmbed()
.setTitle(`Événements du Serveur`)
.setColor('#0099ff');

guildEvents.forEach((event, index) => {
embed.addField(`Événement #${index + 1}`,
`**Titre/Nom:** ${event.title}\n` +
`**Début:** ${event.start}\n` +
`**Lieu:** ${event.location}\n` +
(event.image ? `**Image:** ${event.image}` : '')
);
});

// Envoie l'embed dans le canal où la commande a été utilisée
message.channel.send({ embeds: [embed] });
} else {
message.channel.send('Aucun événement trouvé pour ce serveur.');
}
}
};
But I have an event, but it still say that i don't...
No description
3 Replies
d.js toolkit
d.js toolkit6mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by staff
d.js docs
d.js docs6mo ago
class GuildScheduledEventManager (extends CachedManager) Manages API methods for GuildScheduledEvents and stores their cache.
InkLHT_
InkLHT_6mo ago
wdym DelphiConfuse want my bot to say on an embed the information of the event of a server. Example, in the image, it will say : Title : Evenement test Description : test guidy Where : vocal Date : today or 12/10/23 Start at : 7pm /19h cest finish at : 7:30pm But it says that i don't have one I don't want to use a json or something, i want the bot just reading itself I didn't understand Probably that, it's totally new for me trying a command like that so i'm sorry I mean like, i don't understand why it doesn't work or what can I do to make it work Uh? Okay.. I mean, if it's unclear, you can still try to explain, i will not understand better like that And english is not my first language so of course i will have difficulties to understand your words I showed my code, i don't know what to do more But I don't know how to use doc like that, i always ask people to help. I learn like that. Sigh, wtv, I'll ask somewhere else, thanks anyway I don't undestand the issue i have, you told me, I tried to understand but nothing so Okay, now I understand, thank you !