hullcss-discord-bot/events/guildScheduledEvent.js

30 lines
1.4 KiB
JavaScript
Raw Normal View History

2022-07-04 21:11:13 +01:00
const { MessageAttachment } = require('discord.js');
2022-05-10 21:39:54 +01:00
const client = require("../index");
const discord = require('discord.js');
client.on('guildScheduledEventCreate', async guildScheduledEvent =>{
2022-05-10 21:47:31 +01:00
const channel = client.channels.cache.get('973686987787751534')
2022-05-10 21:39:54 +01:00
const embed = new discord.MessageEmbed()
.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-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}`)
}
embed.addField('Start Date and Time', ` ${guildScheduledEvent.scheduledStartAt.toLocaleString('en-UK')}`, true)
if(guildScheduledEvent.scheduledEndAt !== null)
{
2022-07-04 21:11:13 +01:00
embed.addField('End Date and Time', `${guildScheduledEvent.scheduledEndAt.toLocaleString("en-UK")}`, true)
}
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
})