From 0fc321d35a3f19a811e43648f4bd35c36854332e Mon Sep 17 00:00:00 2001 From: Kieran Date: Mon, 4 Jul 2022 21:11:13 +0100 Subject: [PATCH] Reformat and fix guildScheduleEvent --- events/guildScheduledEvent.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/events/guildScheduledEvent.js b/events/guildScheduledEvent.js index 0dba91c..df41d4d 100644 --- a/events/guildScheduledEvent.js +++ b/events/guildScheduledEvent.js @@ -1,4 +1,4 @@ -const { Permissions } = require('discord.js'); +const { MessageAttachment } = require('discord.js'); const client = require("../index"); const discord = require('discord.js'); @@ -7,18 +7,26 @@ client.on('guildScheduledEventCreate', async guildScheduledEvent =>{ const channel = client.channels.cache.get('973686987787751534') const embed = new discord.MessageEmbed() .setColor('GREEN') - .setFooter(`Created by ${guildScheduledEvent.creator.tag}`) + .setFooter(`Created by ${guildScheduledEvent.creatorId}`) .setTimestamp() .setTitle("New Event") - .setImage(guildScheduledEvent.image) + .setImage(`https://cdn.discordapp.com/guild-events/${guildScheduledEvent.id}/${guildScheduledEvent.image}.png`) .addField('Name:', `${guildScheduledEvent.name}`) .addField('Description', `${guildScheduledEvent.description}`) - .addField('Location', `Please check the URL linked.`) - .addField('Start Date and Time', ` ${guildScheduledEvent.scheduledStartAt.toLocaleDateString("en-UK")}`, true) + if(guildScheduledEvent.entityType !== 'EXTERNAL') + { + embed.addField('Location', `${guildScheduledEvent.channel.name} - [Link](https://discordapp.com/channels/427865794467069962/${guildScheduledEvent.channelId})`) + } + 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.toLocaleDateString("en-UK")}`, true) + embed.addField('End Date and Time', `${guildScheduledEvent.scheduledEndAt.toLocaleString("en-UK")}`, true) } embed.addField('InviteURL', `${guildScheduledEvent.url}`) - channel.send({ embeds: [embed] }) + + + channel.send({ embeds: [embed]}) }) \ No newline at end of file