From 113d1219f96f39ad3c0902bd9544ff498eeceffd Mon Sep 17 00:00:00 2001 From: Kieran Date: Wed, 7 Sep 2022 20:06:49 +0100 Subject: [PATCH] Make timestamps use time discordjs builder --- events/guildScheduledEvent.js | 7 ++++--- events/interactionCreate.js | 7 +++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/events/guildScheduledEvent.js b/events/guildScheduledEvent.js index f38ebb8..f03240a 100644 --- a/events/guildScheduledEvent.js +++ b/events/guildScheduledEvent.js @@ -1,5 +1,6 @@ -const { MessageEmbed } = require('discord.js'); const client = require("../index"); +const { MessageEmbed } = require('discord.js'); +const { time } = require("@discordjs/builders"); client.on('guildScheduledEventCreate', async guildScheduledEvent =>{ const channel = client.channels.cache.get('973686987787751534') @@ -20,10 +21,10 @@ client.on('guildScheduledEventCreate', async guildScheduledEvent =>{ embed.addField('Location', `External - ${guildScheduledEvent.entityMetadata.location}`) } - embed.addField('Start Date and Time', ` ${guildScheduledEvent.scheduledStartAt.toLocaleString('en-UK', { timeZone: "Europe/London" })}`, true) + embed.addField('Start Date and Time', `${guildScheduledEvent.scheduledStartTimestamp ? time(guildScheduledEvent.scheduledStartTimestamp, "F") : "Unknown"}`, true) if(guildScheduledEvent.scheduledEndAt !== null) { - embed.addField('End Date and Time', `${guildScheduledEvent.scheduledEndAt.toLocaleString("en-UK", { timeZone: "Europe/London" })}`, true) + embed.addField('End Date and Time', `${guildScheduledEvent.scheduledEndTimestamp ? time(guildScheduledEvent.scheduledEndTimestamp, "F") : "Unknown"}`, true) } embed.addField('InviteURL', `${guildScheduledEvent.url}`) diff --git a/events/interactionCreate.js b/events/interactionCreate.js index 1ded353..1ff746b 100644 --- a/events/interactionCreate.js +++ b/events/interactionCreate.js @@ -83,14 +83,13 @@ client.on("interactionCreate", async (interaction) => { await interaction.reply({ content: 'Message has been deleted', ephemeral: true}); } - if(interaction.isButton) + + if(interaction.customId == "CloseThread") { - if(interaction.customId == "CloseThread") - { interaction.reply(`This channel has been archived, you can unarchive this thread by sending another message.`) interaction.channel.setArchived(true) - } } + } // Select Menu Handling