upgrade to discord.js v14
This commit is contained in:
24 files changed
+1598
-1560
No files matched your search
+55
-55
@@ -1,4 +1,4 @@
|
||||
const { MessageEmbed, MessageActionRow, MessageButton } = require('discord.js');
|
||||
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js');
|
||||
|
||||
module.exports = {
|
||||
name: "911",
|
||||
@@ -9,41 +9,41 @@ module.exports = {
|
||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||
member: [],
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: "name",
|
||||
description: "Caller name",
|
||||
value: "name",
|
||||
type: 3,
|
||||
required: true
|
||||
},
|
||||
{
|
||||
name: "service",
|
||||
description: "What emergency service you require",
|
||||
value: "service",
|
||||
type: 3,
|
||||
required: true,
|
||||
choices: [
|
||||
{ name: "Fire Dept.", value: "Fire Dept." }, { name: "Law Enforcement", value: "Law Enforcement" },
|
||||
{ name: "EMS (Medical)", value: "EMS" }, { name: "All Dept.", value: "All Dept." }
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "location",
|
||||
description: "The location of your emergency",
|
||||
value: "location",
|
||||
type: 3,
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: "nature",
|
||||
description: "The nature fo your emergency",
|
||||
value: "nature",
|
||||
type: 3,
|
||||
required: true,
|
||||
}
|
||||
],
|
||||
SlashCommand: {
|
||||
options: [
|
||||
{
|
||||
name: "name",
|
||||
description: "Caller name",
|
||||
value: "name",
|
||||
type: 3,
|
||||
required: true
|
||||
},
|
||||
{
|
||||
name: "service",
|
||||
description: "What emergency service you require",
|
||||
value: "service",
|
||||
type: 3,
|
||||
required: true,
|
||||
choices: [
|
||||
{ name: "Fire Dept.", value: "Fire Dept." }, { name: "Law Enforcement", value: "Law Enforcement" },
|
||||
{ name: "EMS (Medical)", value: "EMS" }, { name: "All Dept.", value: "All Dept." }
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "location",
|
||||
description: "The location of your emergency",
|
||||
value: "location",
|
||||
type: 3,
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: "nature",
|
||||
description: "The nature fo your emergency",
|
||||
value: "nature",
|
||||
type: 3,
|
||||
required: true,
|
||||
}
|
||||
],
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/QuarksBot")} client
|
||||
@@ -73,8 +73,8 @@ module.exports = {
|
||||
? '1. `dispatcher_role`\n2. `dispatcher_channel`'
|
||||
: 'Error';
|
||||
|
||||
const errorEmbed = new MessageEmbed()
|
||||
.setColor("RED")
|
||||
const errorEmbed = new EmbedBuilder()
|
||||
.setColor(client.config.Colors.Red)
|
||||
.setTitle("Notice:")
|
||||
.setDescription(`An admin needs to configure the following:\n${configure}`)
|
||||
|
||||
@@ -85,24 +85,24 @@ module.exports = {
|
||||
let status = 'Open';
|
||||
let Description = `**Call ID** ${ID}\n\n**Caller** ${args[0].value}\n**Service** ${args[1].value}\n**Location** ${args[2].value}\n**Nature** ${args[0].value}\n\n**Status**\n\`\`\`diff\n${status=='Open'?'+':'-'} ${status}\`\`\``
|
||||
|
||||
let embed911 = new MessageEmbed()
|
||||
.setColor(client.config.EmbedColor)
|
||||
let embed911 = new EmbedBuilder()
|
||||
.setColor(client.config.Colors.Default)
|
||||
.setTitle('911 Call Alert')
|
||||
.setTimestamp()
|
||||
.setDescription(Description)
|
||||
|
||||
let opt = new MessageActionRow()
|
||||
let opt = new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new MessageButton()
|
||||
new ButtonBuilder()
|
||||
.setCustomId(`close-${GuildDB.dispatcherRole}`)
|
||||
.setLabel("Close")
|
||||
.setStyle("PRIMARY"),
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
)
|
||||
.addComponents(
|
||||
new MessageButton()
|
||||
new ButtonBuilder()
|
||||
.setCustomId(`delete-${GuildDB.dispatcherRole}`)
|
||||
.setLabel("Delete")
|
||||
.setStyle("DANGER"),
|
||||
.setStyle(ButtonStyle.Danger),
|
||||
)
|
||||
|
||||
client.on("interactionCreate", ButtonInteraction => {
|
||||
@@ -111,7 +111,7 @@ module.exports = {
|
||||
if (!ButtonInteraction.member._roles.includes(GuildDB.dispatcherRole)) {
|
||||
return ButtonInteraction.reply({
|
||||
content: "This button is not for you",
|
||||
ephemeral: true
|
||||
flags: (1 << 6)
|
||||
})
|
||||
}
|
||||
if (queryString.startsWith('close')) {
|
||||
@@ -122,28 +122,28 @@ module.exports = {
|
||||
status = 'Open';
|
||||
Description = `**Call ID** ${ID}\n\n**Caller** ${args[0].value}\n**Service** ${args[1].value}\n**Location** ${args[2].value}\n**Nature** ${args[0].value}\n\n**Status**\n\`\`\`diff\n${status=='Open'?'+':'-'} ${status}\`\`\``
|
||||
} else if (queryString.startsWith('delete')) {
|
||||
const closedEmbed = new MessageEmbed().setTitle('Deleted Call').setColor(client.config.EmbedColor);
|
||||
const closedEmbed = new EmbedBuilder().setTitle('Deleted Call').setColor(client.config.Colors.Default);
|
||||
return ButtonInteraction.update({ embeds: [closedEmbed], components: [] });
|
||||
}
|
||||
|
||||
embed911 = new MessageEmbed()
|
||||
.setColor(client.config.EmbedColor)
|
||||
embed911 = new EmbedBuilder()
|
||||
.setColor(client.config.Colors.Default)
|
||||
.setTitle('911 Call Alert')
|
||||
.setTimestamp()
|
||||
.setDescription(Description)
|
||||
|
||||
opt = new MessageActionRow()
|
||||
opt = new ActionRowBuilder()
|
||||
.addComponents(
|
||||
new MessageButton()
|
||||
new ButtonBuilder()
|
||||
.setCustomId(`${queryString.startsWith('close')?'Open':'Close'}-${GuildDB.dispatcherRole}`)
|
||||
.setLabel(queryString.startsWith('close')?'Open':'Close')
|
||||
.setStyle("PRIMARY"),
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
)
|
||||
.addComponents(
|
||||
new MessageButton()
|
||||
new ButtonBuilder()
|
||||
.setCustomId(`delete-${GuildDB.dispatcherRole}`)
|
||||
.setLabel("Delete")
|
||||
.setStyle("DANGER"),
|
||||
.setStyle(ButtonStyle.Danger),
|
||||
)
|
||||
|
||||
return ButtonInteraction.update({ embeds: [embed911], components: [opt] });
|
||||
@@ -151,9 +151,9 @@ module.exports = {
|
||||
|
||||
const channel = interaction.guild.channels.cache.find(channel => channel.id === GuildDB.dispatchChannel);
|
||||
if (!channel) {
|
||||
const embed = new MessageEmbed()
|
||||
const embed = new EmbedBuilder()
|
||||
.setDescriptions(`**Internal Error:** ${err}\nThe channel may have been deleted\nContact the Developers\nhttps://discord.gg/YCXhvy9uZw`)
|
||||
.setColor("RED")
|
||||
.setColor(client.config.Colors.Red)
|
||||
|
||||
return interaction.send({ embeds: [embed] });
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user