hullcss-discord-bot/events/guildScheduledEvent.js

32 lines
1.4 KiB
JavaScript
Raw Normal View History

2022-08-26 13:33:00 +01:00
const { MessageEmbed } = require('discord.js');
2022-05-10 21:39:54 +01:00
const client = require("../index");
client.on('guildScheduledEventCreate', async guildScheduledEvent =>{
2022-05-10 21:47:31 +01:00
const channel = client.channels.cache.get('973686987787751534')
2022-07-09 10:31:08 +01:00
const embed = new MessageEmbed()
2022-05-10 21:39:54 +01:00
.setColor('GREEN')
2022-08-26 13:41:53 +01:00
.setFooter({text: `Created by ${guildScheduledEvent.creator.tag}`})
2022-05-10 21:39:54 +01:00
.setTimestamp()
2022-09-04 18:44:07 +01:00
.setTitle(guildScheduledEvent.name)
2022-07-04 21:11:13 +01:00
.setImage(`https://cdn.discordapp.com/guild-events/${guildScheduledEvent.id}/${guildScheduledEvent.image}.png`)
2022-05-10 21:39:54 +01:00
.addField('Description', `${guildScheduledEvent.description}`)
2022-07-09 10:31:08 +01:00
2022-09-04 19:05:35 +01:00
if(guildScheduledEvent.entityType !== 'EXTERNAL')
{
2022-07-04 21:11:13 +01:00
embed.addField('Location', `${guildScheduledEvent.channel.name} - [Link](https://discordapp.com/channels/427865794467069962/${guildScheduledEvent.channelId})`)
}
2022-09-04 19:05:35 +01:00
else
{
embed.addField('Location', `External - ${guildScheduledEvent.entityMetadata.location}`)
}
2022-07-09 10:31:08 +01:00
2022-09-04 19:03:49 +01:00
embed.addField('Start Date and Time', ` ${guildScheduledEvent.scheduledStartAt.toLocaleString('en-UK', { timeZone: "Europe/London" })}`, true)
if(guildScheduledEvent.scheduledEndAt !== null)
{
2022-09-04 18:44:07 +01:00
embed.addField('End Date and Time', `${guildScheduledEvent.scheduledEndAt.toLocaleString("en-UK", { timeZone: "Europe/London" })}`, true)
}
2022-07-09 10:31:08 +01:00
embed.addField('InviteURL', `${guildScheduledEvent.url}`)
2022-09-04 19:05:35 +01:00
2022-07-04 21:11:13 +01:00
channel.send({ embeds: [embed]})
2022-05-10 21:39:54 +01:00
})