diff --git a/events/guildScheduledEvent.js b/events/guildScheduledEvent.js index a5da6a5..70f6048 100644 --- a/events/guildScheduledEvent.js +++ b/events/guildScheduledEvent.js @@ -1,11 +1,10 @@ -const { MessageAttachment } = require('discord.js'); +const { MessageAttachment, MessageEmbed } = require('discord.js'); const client = require("../index"); -const discord = require('discord.js'); client.on('guildScheduledEventCreate', async guildScheduledEvent =>{ const channel = client.channels.cache.get('973686987787751534') - const embed = new discord.MessageEmbed() + const embed = new MessageEmbed() .setColor('GREEN') .setFooter(`Created by ${guildScheduledEvent.creatorId}`) .setTimestamp() @@ -13,6 +12,7 @@ client.on('guildScheduledEventCreate', async guildScheduledEvent =>{ .setImage(`https://cdn.discordapp.com/guild-events/${guildScheduledEvent.id}/${guildScheduledEvent.image}.png`) .addField('Name:', `${guildScheduledEvent.name}`) .addField('Description', `${guildScheduledEvent.description}`) + if(guildScheduledEvent.entityType !== 'EXTERNAL') { embed.addField('Location', `${guildScheduledEvent.channel.name} - [Link](https://discordapp.com/channels/427865794467069962/${guildScheduledEvent.channelId})`) @@ -20,11 +20,14 @@ client.on('guildScheduledEventCreate', async guildScheduledEvent =>{ else{ embed.addField('Location', `External - ${guildScheduledEvent.entityMetadata.location}`) } + embed.addField('Start Date and Time', ` ${guildScheduledEvent.scheduledStartAt.toLocaleString('en-UK')}`, true) + if(guildScheduledEvent.scheduledEndAt !== null) { embed.addField('End Date and Time', `${guildScheduledEvent.scheduledEndAt.toLocaleString("en-UK")}`, true) } + embed.addField('InviteURL', `${guildScheduledEvent.url}`) channel.send({ embeds: [embed]}) }) \ No newline at end of file