2022-05-10 21:39:54 +01:00
|
|
|
const client = require("../index");
|
2022-09-07 20:06:49 +01:00
|
|
|
const { MessageEmbed } = require('discord.js');
|
|
|
|
const { time } = require("@discordjs/builders");
|
2022-05-10 21:39:54 +01:00
|
|
|
|
|
|
|
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-09-06 11:26:17 +01:00
|
|
|
.setTitle(guildScheduledEvent.name)
|
|
|
|
.setDescription(guildScheduledEvent.description)
|
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-07-04 21:11:13 +01:00
|
|
|
.setImage(`https://cdn.discordapp.com/guild-events/${guildScheduledEvent.id}/${guildScheduledEvent.image}.png`)
|
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-07 20:13:58 +01:00
|
|
|
embed.addField('Start Date and Time', `${guildScheduledEvent.scheduledStartAt ? time(guildScheduledEvent.scheduledStartAt, "F") : "Unknown"}`, true)
|
2022-07-04 18:56:53 +01:00
|
|
|
if(guildScheduledEvent.scheduledEndAt !== null)
|
|
|
|
{
|
2022-09-07 20:13:58 +01:00
|
|
|
embed.addField('End Date and Time', `${guildScheduledEvent.scheduledEndAt ? time(guildScheduledEvent.scheduledEndAt, "F") : "Unknown"}`, 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-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
|
|
|
})
|