From 4d99e0f2bca46dc57d374ca88fa3b9137a58ce60 Mon Sep 17 00:00:00 2001 From: Kieran Date: Mon, 4 Jul 2022 18:56:53 +0100 Subject: [PATCH] Added image to event embed and check for null end --- events/guildScheduledEvent.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/events/guildScheduledEvent.js b/events/guildScheduledEvent.js index a497de9..0dba91c 100644 --- a/events/guildScheduledEvent.js +++ b/events/guildScheduledEvent.js @@ -10,11 +10,15 @@ client.on('guildScheduledEventCreate', async guildScheduledEvent =>{ .setFooter(`Created by ${guildScheduledEvent.creator.tag}`) .setTimestamp() .setTitle("New Event") + .setImage(guildScheduledEvent.image) .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) - .addField('End Date and Time', `${guildScheduledEvent.scheduledEndAt.toLocaleDateString("en-UK")}`, true) - .addField('InviteURL', `${guildScheduledEvent.url}`) + if(guildScheduledEvent.scheduledEndAt !== null) + { + embed.addField('End Date and Time', `${guildScheduledEvent.scheduledEndAt.toLocaleDateString("en-UK")}`, true) + } + embed.addField('InviteURL', `${guildScheduledEvent.url}`) channel.send({ embeds: [embed] }) }) \ No newline at end of file