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-07-04 21:11:13 +01:00
|
|
|
.setFooter(`Created by ${guildScheduledEvent.creatorId}`)
|
2022-05-10 21:39:54 +01:00
|
|
|
.setTimestamp()
|
|
|
|
.setTitle("New Event")
|
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('Name:', `${guildScheduledEvent.name}`)
|
|
|
|
.addField('Description', `${guildScheduledEvent.description}`)
|
2022-07-09 10:31:08 +01:00
|
|
|
|
2022-07-04 21:11:13 +01:00
|
|
|
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}`)
|
|
|
|
}
|
2022-07-09 10:31:08 +01:00
|
|
|
|
2022-07-04 21:11:13 +01:00
|
|
|
embed.addField('Start Date and Time', ` ${guildScheduledEvent.scheduledStartAt.toLocaleString('en-UK')}`, true)
|
2022-07-09 10:31:08 +01:00
|
|
|
|
2022-07-04 18:56:53 +01:00
|
|
|
if(guildScheduledEvent.scheduledEndAt !== null)
|
|
|
|
{
|
2022-07-04 21:11:13 +01:00
|
|
|
embed.addField('End Date and Time', `${guildScheduledEvent.scheduledEndAt.toLocaleString("en-UK")}`, true)
|
2022-07-04 18:56:53 +01:00
|
|
|
}
|
2022-07-09 10:31:08 +01:00
|
|
|
|
2022-07-04 18:56:53 +01:00
|
|
|
embed.addField('InviteURL', `${guildScheduledEvent.url}`)
|
2022-07-04 21:11:13 +01:00
|
|
|
channel.send({ embeds: [embed]})
|
2022-05-10 21:39:54 +01:00
|
|
|
})
|