hullcss-discord-bot/events/guildScheduledEvent.js

33 lines
1.4 KiB
JavaScript
Raw Normal View History

2022-05-10 21:39:54 +01:00
const client = require("../index");
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-09-09 19:12:22 +01:00
.setImage(`https://cdn.discordapp.com/guild-events/${guildScheduledEvent.id}/${guildScheduledEvent.image}.png?size=2048`)
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-09 11:11:41 +01:00
embed.addField('Start Date and Time', `${guildScheduledEvent.scheduledStartAt.toLocaleString('en-UK', { timeZone: "Europe/London" })}`, true)
if(guildScheduledEvent.scheduledEndAt !== null)
{
2022-09-09 11:11:41 +01:00
embed.addField('End Date and Time', `${guildScheduledEvent.scheduledStartAt.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
})