Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
96a50743ac | ||
|
|
5cd759eb86 | ||
|
|
fd263d1f8e | ||
|
|
df5c35642d | ||
|
|
c9d2e471b7 | ||
|
|
d1bd624723 | ||
|
|
1f2bd9c279 | ||
|
|
ab14b17cc9 | ||
|
|
e1244f779f | ||
|
|
d474f04122 | ||
|
|
24c4cb0dd1 | ||
|
|
d7d765d4b9 | ||
|
|
bc82bf6c55 | ||
|
|
213f84f509 | ||
|
|
25c6c95ec5 | ||
|
|
9118bff570 | ||
|
|
3f3670b4f3 | ||
|
|
d448662072 | ||
|
|
84fa2c3078 | ||
|
|
da88fe64ba | ||
|
|
d74cd36880 | ||
|
|
b8d1361796 | ||
|
|
b205132d1a | ||
|
|
77812967de | ||
|
|
6103fc9f04 | ||
|
|
44fbe9f2d6 | ||
|
|
29db6c7d67 | ||
|
|
69f0b00ed3 | ||
|
|
c1a1839457 | ||
|
|
dd4b53800e | ||
|
|
1fc94528fc | ||
|
|
bb1a817980 | ||
|
|
53305acbc7 | ||
|
|
d0f1bae0bd | ||
|
|
c0cf3b1bb7 | ||
|
|
ce67b668d5 | ||
|
|
3273cfd0e1 | ||
|
|
fd992a6514 | ||
|
|
550d681fe1 | ||
|
|
7d29226953 | ||
|
|
38da72ca91 | ||
|
|
eab11361cb | ||
|
|
b281bba36f | ||
|
|
5e38573aed | ||
|
|
da7b6d487c | ||
|
|
6bf4e5f4bb | ||
|
|
213f532a3c | ||
|
|
45bd88e4d2 | ||
|
|
4eb8658459 | ||
|
|
b37118fee2 | ||
|
|
026caba68a | ||
|
|
2003f8801a | ||
|
|
473bacf13a | ||
|
|
8b3f2bc61a | ||
|
|
3aa373c33c | ||
|
|
9b6263e583 | ||
|
|
3e066d08ce | ||
|
|
aa48e28162 | ||
|
|
dc660ed94a | ||
|
|
e02ecf9553 | ||
|
|
23acc0926f | ||
|
|
3fc1cd18d5 | ||
|
|
ebe29b403e | ||
|
|
dcba3312dd | ||
|
|
7fddeeec37 | ||
|
|
b5341b023f | ||
|
|
bbb7443ef2 | ||
|
|
22df347bb9 | ||
|
|
9aed6b8f35 | ||
|
|
9e7ec9f1bd | ||
|
|
373f43eac5 | ||
|
|
6c91b2791a | ||
|
|
bde62a431f | ||
|
|
615a074540 | ||
|
|
09b335ac46 | ||
|
|
2701880c77 | ||
|
|
24c8f2fb38 | ||
|
|
c3ec158ac3 | ||
|
|
b3690222d0 | ||
|
|
4d7583785b | ||
|
|
17ad1a15db | ||
|
|
4c89de9e76 | ||
|
|
5f25af41f9 | ||
|
|
3a3ee357fc | ||
|
|
08a6d27903 | ||
|
|
33f7675aac | ||
|
|
1178a0a611 | ||
|
|
96ded77bec | ||
|
|
e83ca8cb2b | ||
|
|
e507176d39 | ||
|
|
4e554b8bee | ||
|
|
bc649caa99 | ||
|
|
f7a4c7b616 | ||
|
|
2c7be5882c | ||
|
|
6107d268f7 | ||
|
|
7760699155 | ||
|
|
acf349c72e | ||
|
|
8096e5b882 | ||
|
|
873cfc7dc2 | ||
|
|
038174bc7e | ||
|
|
14881096bb | ||
|
|
ed1905d8f4 | ||
|
|
72c0a2efa3 | ||
|
|
e599d48713 | ||
|
|
7f44634d4f | ||
|
|
44170caac6 | ||
|
|
adedfadd92 | ||
|
|
6b01d0c8fe | ||
|
|
d4d96f59ab | ||
|
|
a1bf7ed6bd | ||
|
|
306e20efc9 | ||
|
|
f593f6e0a8 | ||
|
|
74646a4318 | ||
|
|
8bfcba8832 | ||
|
|
4ba5621a4d | ||
|
|
1f928324c2 | ||
|
|
3771872cd2 | ||
|
|
f359a60343 | ||
|
|
f53afd7bc9 | ||
|
|
e7dcc2ab29 | ||
|
|
0118b9e591 | ||
|
|
ffe42f9777 | ||
|
|
5a467599e9 | ||
|
|
c56e78484a | ||
|
|
1ee0d4a09e | ||
|
|
ffdce5820b | ||
|
|
9fed504f37 | ||
|
|
6c5799be0d | ||
|
|
b6747a0340 | ||
|
|
cd6df02e30 | ||
|
|
edbef6a36f | ||
|
|
b6a0016f5f | ||
|
|
e740c17837 | ||
|
|
7eb949f109 | ||
|
|
02394e310d | ||
|
|
ef83832819 | ||
|
|
a82101ab30 | ||
|
|
007c78930e | ||
|
|
300c83512c | ||
|
|
b674872c56 | ||
|
|
12a7680275 | ||
|
|
c9cf7c942b | ||
|
|
8e0326c8f8 | ||
|
|
13972119a8 | ||
|
|
acf165a119 | ||
|
|
bdff7c6069 | ||
|
|
e2e3376c87 | ||
|
|
3c613088e5 | ||
|
|
7e9ece50a0 | ||
|
|
af81b6536a | ||
|
|
4cd3ecf81f | ||
|
|
31f6b9e08e | ||
|
|
02de920cb3 | ||
|
|
84c0905297 | ||
|
|
250583f859 | ||
|
|
ee7d42196d | ||
|
|
a397de2b9f | ||
|
|
0610df9400 | ||
|
|
ed583deb31 | ||
|
|
e039048fc6 | ||
|
|
f2ea9650c4 | ||
|
|
1e89057006 | ||
|
|
019bb4842f | ||
|
|
4cb45beded | ||
|
|
8a2059f087 | ||
|
|
a6b105a2e1 | ||
|
|
6c14a6a06c | ||
|
|
cddd5d0026 | ||
|
|
78dea91e1d | ||
|
|
3df591ec52 | ||
|
|
1c4032caa6 | ||
|
|
465c422171 | ||
|
|
284e8dc6f5 | ||
|
|
3fc905c82e | ||
|
|
55a42b88ae | ||
|
|
bd26162e4a | ||
|
|
62e7e33406 | ||
|
|
2f0ddcec3f | ||
|
|
7cdfa68e0e | ||
|
|
f8939a964d | ||
|
|
7830e5dda5 | ||
|
|
6aa2f22294 | ||
|
|
50b14e3d44 | ||
|
|
e09c2192c2 | ||
|
|
b725d2cc62 | ||
|
|
abf3f617a4 | ||
|
|
1eda7e66fe | ||
|
|
b5000531c4 | ||
|
|
d4f95e752b | ||
|
|
e31c611f70 | ||
|
|
085481bee6 | ||
|
|
cf610fbe49 | ||
|
|
b681eb3cd2 | ||
|
|
f8ffdf0e81 | ||
|
|
ba38bce1da | ||
|
|
3a39b05fe4 | ||
|
|
27d2982b28 | ||
|
|
33e4d97be5 | ||
|
|
654064d7c5 | ||
|
|
aeb0da9e0d | ||
|
|
cb1a2fe067 | ||
|
|
85667ddfad | ||
|
|
7ad5016966 | ||
|
|
45c3315fd0 | ||
|
|
c5f550dd00 | ||
|
|
37c870c7ab |
No files matched your search
@@ -1,32 +0,0 @@
|
||||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
||||
|
||||
name: Node.js CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [10.x, 12.x, 14.x, 15.x]
|
||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- run: npm ci
|
||||
- run: npm install discord.js --save
|
||||
- run: npm install js-yaml
|
||||
- run: npm run build --if-present
|
||||
- run: node index.js
|
||||
@@ -0,0 +1,2 @@
|
||||
node_modules/
|
||||
.DS_Store
|
||||
@@ -0,0 +1,45 @@
|
||||
// SupportBot | Emerald Services
|
||||
// Example (default) Addon
|
||||
|
||||
const fs = require("fs");
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(
|
||||
fs.readFileSync("./Configs/supportbot.yml", "utf8")
|
||||
);
|
||||
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
|
||||
|
||||
// Your Addon Config file! Saved in /Addons/Configs/YourAddonConfig.yml
|
||||
// const config = yaml.load(fs.readFileSync('./Addons/Configs/YourAddonConfig.yml', 'utf8'));
|
||||
|
||||
const { Command, Event } = require("../Structures/Addon");
|
||||
|
||||
module.exports.commands = [
|
||||
/*
|
||||
// EXAMPLE COMMAND
|
||||
new Command({
|
||||
name: "hello",
|
||||
description: "hello",
|
||||
options: [],
|
||||
permissions: ["SEND_MESSAGES"],
|
||||
async run(interaction) {
|
||||
const Embed = new Discord.MessageEmbed()
|
||||
.setDescription("Hello World!")
|
||||
.setColor(supportbot.InfoColour);
|
||||
|
||||
interaction.reply({
|
||||
embeds: [Embed],
|
||||
});
|
||||
},
|
||||
}),
|
||||
*/
|
||||
];
|
||||
module.exports.events = [
|
||||
/*
|
||||
// EXAMPLE EVENT
|
||||
new Event("ready", async (client) => {
|
||||
console.log("Bot started!");
|
||||
}),
|
||||
*/
|
||||
];
|
||||
@@ -0,0 +1,92 @@
|
||||
// SupportBot | Emerald Services
|
||||
// Ticket Add Command
|
||||
|
||||
const fs = require("fs");
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(
|
||||
fs.readFileSync("./Configs/supportbot.yml", "utf8")
|
||||
);
|
||||
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
|
||||
|
||||
const Command = require("../Structures/Command.js");
|
||||
|
||||
module.exports = new Command({
|
||||
name: cmdconfig.TicketAdd,
|
||||
description: cmdconfig.TicketAddDesc,
|
||||
options: [
|
||||
{
|
||||
name: "user",
|
||||
description: "User to add",
|
||||
type: "USER",
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
permissions: ["SEND_MESSAGES"],
|
||||
|
||||
async run(interaction) {
|
||||
const { getRole } = interaction.client;
|
||||
let SupportStaff = await getRole(supportbot.Staff, interaction.guild);
|
||||
let Admin = await getRole(supportbot.Admin, interaction.guild);
|
||||
if (!SupportStaff || !Admin)
|
||||
return interaction.reply(
|
||||
"Some roles seem to be missing!\nPlease check for errors when starting the bot."
|
||||
);
|
||||
|
||||
const NoPerms = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Permissions!")
|
||||
.setDescription(
|
||||
`${supportbot.IncorrectPerms}\n\nRole Required: \`${supportbot.Staff}\` or \`${supportbot.Admin}\``
|
||||
)
|
||||
.setColor(supportbot.WarningColour);
|
||||
|
||||
if (
|
||||
!interaction.member.roles.cache.has(SupportStaff.id) &&
|
||||
!interaction.member.roles.cache.has(Admin.id)
|
||||
)
|
||||
return interaction.reply({ ephemeral: true, embeds: [NoPerms] });
|
||||
|
||||
let TicketData = await JSON.parse(
|
||||
fs.readFileSync("./Data/TicketData.json", "utf8")
|
||||
);
|
||||
let ticket = await TicketData.tickets.findIndex(
|
||||
(t) => t.id === interaction.channel.id
|
||||
);
|
||||
if (ticket === -1) {
|
||||
const Exists = new Discord.MessageEmbed()
|
||||
.setTitle("No Ticket Found!")
|
||||
.setDescription(supportbot.NoValidTicket)
|
||||
.setColor(supportbot.WarningColour);
|
||||
return interaction.reply({ ephemeral: true, embeds: [Exists] });
|
||||
}
|
||||
|
||||
let uMember = interaction.options.getUser("user");
|
||||
const UserNotExist = new Discord.MessageEmbed()
|
||||
.setTitle("User Not Found!")
|
||||
.setDescription(
|
||||
`${supportbot.UserNotFound}\n\nTry Again:\`/${cmdconfig.TicketAdd} <user#0000>\``
|
||||
)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
|
||||
if (!uMember) return interaction.reply({ embeds: [UserNotExist] });
|
||||
|
||||
await interaction.channel.permissionOverwrites.edit(uMember.id, {
|
||||
VIEW_CHANNEL: true,
|
||||
});
|
||||
const Complete = new Discord.MessageEmbed()
|
||||
.setTitle("User Added!")
|
||||
.setDescription(supportbot.AddedUser.replace(/%user%/g, uMember.id))
|
||||
.setTimestamp()
|
||||
.setColor(supportbot.EmbedColour);
|
||||
interaction.reply({ embeds: [Complete] });
|
||||
TicketData.tickets[ticket].subUsers.push(uMember.id);
|
||||
fs.writeFileSync(
|
||||
"./Data/TicketData.json",
|
||||
JSON.stringify(TicketData, null, 4),
|
||||
(err) => {
|
||||
if (err) console.error(err);
|
||||
}
|
||||
);
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,199 @@
|
||||
// SupportBot | Emerald Services
|
||||
// Close Ticket Command
|
||||
|
||||
const fs = require("fs");
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(
|
||||
fs.readFileSync("./Configs/supportbot.yml", "utf8")
|
||||
);
|
||||
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
|
||||
|
||||
const Command = require("../Structures/Command.js");
|
||||
|
||||
module.exports = new Command({
|
||||
name: cmdconfig.CloseTicket,
|
||||
description: cmdconfig.CloseTicketDesc,
|
||||
options: [
|
||||
{
|
||||
name: "reason",
|
||||
description: "Ticket Close Reason",
|
||||
type: "STRING",
|
||||
},
|
||||
],
|
||||
permissions: ["SEND_MESSAGES"],
|
||||
|
||||
async run(interaction) {
|
||||
const { getRole, getChannel } = interaction.client;
|
||||
if (supportbot.StaffOnly) {
|
||||
let SupportStaff = await getRole(supportbot.Staff, interaction.guild);
|
||||
let Admin = await getRole(supportbot.Admin, interaction.guild);
|
||||
if (!SupportStaff || !Admin)
|
||||
return interaction.reply(
|
||||
"Some roles seem to be missing!\nPlease check for errors when starting the bot."
|
||||
);
|
||||
const NoPerms = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Permissions!")
|
||||
.setDescription(
|
||||
`${supportbot.IncorrectPerms}\n\nRole Required: \`${supportbot.Staff}\` or \`${supportbot.Admin}\``
|
||||
)
|
||||
.setColor(supportbot.WarningColour);
|
||||
|
||||
if (
|
||||
!interaction.member.roles.cache.has(SupportStaff.id) &&
|
||||
!interaction.member.roles.cache.has(Admin.id)
|
||||
)
|
||||
return interaction.reply({ embeds: [NoPerms] });
|
||||
}
|
||||
await interaction.deferReply();
|
||||
let tickets = await JSON.parse(
|
||||
fs.readFileSync("./Data/TicketData.json", "utf8")
|
||||
);
|
||||
let TicketData = await tickets.tickets.findIndex(
|
||||
(t) => t.id === interaction.channel.id
|
||||
);
|
||||
let ticket = tickets.tickets[TicketData];
|
||||
if (TicketData === -1) {
|
||||
const Exists = new Discord.MessageEmbed()
|
||||
.setTitle("No Ticket Found!")
|
||||
.setDescription(supportbot.NoValidTicket)
|
||||
.setColor(supportbot.WarningColour);
|
||||
return interaction.followUp({ embeds: [Exists] });
|
||||
}
|
||||
let tUser = interaction.client.users.cache.get(ticket.user);
|
||||
let transcriptChannel = await getChannel(
|
||||
supportbot.TranscriptLog,
|
||||
interaction.guild
|
||||
);
|
||||
let logChannel = await getChannel(supportbot.TicketLog, interaction.guild);
|
||||
let reason =
|
||||
(await interaction.options?.getString("reason")) || "No Reason Provided.";
|
||||
|
||||
if (!transcriptChannel || !logChannel)
|
||||
return interaction.followUp("Some Channels seem to be missing!");
|
||||
if (supportbot.CloseConfirmation) {
|
||||
const CloseTicketRequest = new Discord.MessageEmbed()
|
||||
.setTitle(`**${supportbot.ClosingTicket}**`)
|
||||
.setDescription(
|
||||
`Please confirm by repeating the following word.. \`${supportbot.ClosingConfirmation_Word}\` `
|
||||
)
|
||||
.setColor(supportbot.EmbedColour);
|
||||
await interaction.followUp({ embeds: [CloseTicketRequest] });
|
||||
let filter = (m) =>
|
||||
m.content.toLowerCase() === supportbot.ClosingConfirmation_Word &&
|
||||
m.author.id === interaction.user.id;
|
||||
await interaction.channel.awaitMessages({
|
||||
filter,
|
||||
max: 1,
|
||||
time: 20000,
|
||||
errors: ["time"],
|
||||
});
|
||||
}
|
||||
try {
|
||||
tickets.tickets[TicketData].open = false;
|
||||
fs.writeFileSync(
|
||||
"./Data/TicketData.json",
|
||||
JSON.stringify(tickets, null, 4),
|
||||
(err) => {
|
||||
if (err) console.error(err);
|
||||
}
|
||||
);
|
||||
await interaction.followUp(`**${supportbot.ClosingTicket}**`);
|
||||
const transcriptEmbed = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.TranscriptTitle)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter({
|
||||
text: supportbot.EmbedFooter,
|
||||
iconURL: interaction.user.displayAvatarURL(),
|
||||
})
|
||||
.addField(
|
||||
"Ticket",
|
||||
`${interaction.channel.name} (${interaction.channel.id})`
|
||||
)
|
||||
.addField(
|
||||
"User",
|
||||
`${tUser?.username || "N/A"}#${tUser?.discriminator || "N/A"} (${
|
||||
tUser?.id || ticket.user
|
||||
})`
|
||||
)
|
||||
.addField("Closed By", interaction.user.tag)
|
||||
.addField("Reason", reason);
|
||||
const logEmbed = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.TicketLog_Title)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter({
|
||||
text: supportbot.EmbedFooter,
|
||||
iconURL: interaction.user.displayAvatarURL(),
|
||||
})
|
||||
.addField(
|
||||
"Ticket",
|
||||
`${interaction.channel.name} (${interaction.channel.id})`
|
||||
)
|
||||
.addField(
|
||||
"User",
|
||||
`${tUser?.username || "N/A"}#${tUser?.discriminator || "N/A"} (${
|
||||
tUser?.id || ticket.user
|
||||
})`
|
||||
)
|
||||
.addField("Closed By", interaction.user.tag)
|
||||
.addField("Reason", reason);
|
||||
let msgs = await interaction.channel.messages.fetch({ limit: 100 });
|
||||
let html = "";
|
||||
|
||||
msgs = msgs.sort((a, b) => a.createdTimestamp - b.createdTimestamp);
|
||||
html += `<style>* {background-color: #2c2f33;color: #fff;font-family: Arial, Helvetica, sans-serif;}</style>`;
|
||||
html += `<strong>Server Name:</strong> ${interaction.guild.name}<br>`;
|
||||
html += `<strong>Ticket:</strong> ${interaction.channel.name}<br>`;
|
||||
html += `<strong>Message:</strong> ${msgs.size} Messages<br><br><br>`;
|
||||
|
||||
await msgs.forEach((msg) => {
|
||||
if (msg.content) {
|
||||
html += `<strong>User:</strong> ${msg.author.tag}<br>`;
|
||||
html += `<strong>Message:</strong> ${msg.content}<br>`;
|
||||
html += `-----<br><br>`;
|
||||
}
|
||||
});
|
||||
if (!(supportbot.DisableTicketLogChannel)) {
|
||||
await logChannel.send({ embeds: [logEmbed] }).catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
}
|
||||
let file = new Discord.MessageAttachment(
|
||||
Buffer.from(html),
|
||||
`${interaction.channel.name}.html`
|
||||
);
|
||||
await transcriptChannel
|
||||
.send({ embeds: [transcriptEmbed], files: [file] })
|
||||
.catch(async (err) => {
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
if (supportbot.DMTranscripts) {
|
||||
|
||||
await tUser
|
||||
?.send({ embeds: [transcriptEmbed], files: [file] })
|
||||
.catch(async (err) => {
|
||||
console.error(err);
|
||||
});
|
||||
if (ticket.subUsers) {
|
||||
ticket.subUsers.forEach(async (subUser) => {
|
||||
await interaction.client.users.cache
|
||||
.get(subUser)
|
||||
?.send({ embeds: [transcriptEmbed], files: [file] });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
await interaction.channel.delete().catch(async (error) => {
|
||||
console.error(error);
|
||||
if (error.code !== Discord.Constants.APIErrors.UNKNOWN_CHANNEL) {
|
||||
console.error("Failed to delete the interaction:", error);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,107 @@
|
||||
// SupportBot | Emerald Services
|
||||
// Embed Command
|
||||
|
||||
const fs = require("fs");
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(
|
||||
fs.readFileSync("./Configs/supportbot.yml", "utf8")
|
||||
);
|
||||
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
|
||||
|
||||
const Command = require("../Structures/Command.js");
|
||||
|
||||
module.exports = new Command({
|
||||
name: cmdconfig.EmbedCommand,
|
||||
description: cmdconfig.EmbedCommandDesc,
|
||||
options: [
|
||||
{
|
||||
name: "title",
|
||||
description: "Embed Title",
|
||||
type: "STRING",
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: "message",
|
||||
description: "Embed Message",
|
||||
type: "STRING",
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: "color",
|
||||
description: "Embed HEX Color",
|
||||
type: "STRING",
|
||||
required: false,
|
||||
},
|
||||
{
|
||||
name: "fieldtitle",
|
||||
description: "Add an additional Embed Field",
|
||||
type: "STRING",
|
||||
required: false,
|
||||
},
|
||||
{
|
||||
name: "fieldcontent",
|
||||
description: "Add an additional Embed Field",
|
||||
type: "STRING",
|
||||
required: false,
|
||||
},
|
||||
{
|
||||
name: "thumbnail",
|
||||
description: "Embed Thumbnail URL",
|
||||
type: "STRING",
|
||||
required: false,
|
||||
},
|
||||
{
|
||||
name: "image",
|
||||
description: "Embed Image URL",
|
||||
type: "STRING",
|
||||
required: false,
|
||||
},
|
||||
],
|
||||
permissions: ["SEND_MESSAGES"],
|
||||
|
||||
async run(interaction) {
|
||||
const { getRole } = interaction.client;
|
||||
let SupportStaff = await getRole(supportbot.Staff, interaction.guild);
|
||||
let Admin = await getRole(supportbot.Admin, interaction.guild);
|
||||
|
||||
if (!SupportStaff || !Admin)
|
||||
return interaction.reply(
|
||||
"Some roles seem to be missing!\nPlease check for errors when starting the bot."
|
||||
);
|
||||
const NoPerms = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Permissions!")
|
||||
.setDescription(
|
||||
`${supportbot.IncorrectPerms}\n\nRole Required: \`${supportbot.Staff}\` or \`${supportbot.Admin}\``
|
||||
)
|
||||
.setColor(supportbot.WarningColour);
|
||||
|
||||
if (
|
||||
interaction.member.roles.cache.has(SupportStaff.id) ||
|
||||
interaction.member.roles.cache.has(Admin.id)
|
||||
) {
|
||||
const EmbedTitle = interaction.options.getString("title");
|
||||
const EmbedSubject = interaction.options.getString("message");
|
||||
const EmbedColour = interaction.options.getString("color");
|
||||
const EmbedThumbnail = interaction.options.getString("thumbnail");
|
||||
const EmbedImage = interaction.options.getString("image");
|
||||
const EmbedFieldContent = interaction.options.getString("fieldcontent");
|
||||
const EmbedFieldTitle = interaction.options.getString("fieldtitle");
|
||||
|
||||
const EmbedMsg = new Discord.MessageEmbed()
|
||||
.setTitle(EmbedTitle)
|
||||
.setDescription(EmbedSubject)
|
||||
.setColor(EmbedColour)
|
||||
.setThumbnail(EmbedThumbnail)
|
||||
.setImage(EmbedImage)
|
||||
if (EmbedFieldTitle && EmbedFieldContent) { EmbedMsg.addField(EmbedFieldTitle, EmbedFieldContent) };
|
||||
|
||||
interaction.reply({
|
||||
embeds: [EmbedMsg],
|
||||
});
|
||||
} else {
|
||||
return interaction.reply({ embeds: [NoPerms] });
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,89 @@
|
||||
// SupportBot | Emerald Services
|
||||
// Help Command
|
||||
|
||||
const fs = require("fs");
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(
|
||||
fs.readFileSync("./Configs/supportbot.yml", "utf8")
|
||||
);
|
||||
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
|
||||
|
||||
const Command = require("../Structures/Command.js");
|
||||
|
||||
module.exports = new Command({
|
||||
name: cmdconfig.HelpCommand,
|
||||
description: cmdconfig.HelpCommandDesc,
|
||||
options: [],
|
||||
permissions: ["SEND_MESSAGES"],
|
||||
|
||||
async run(interaction) {
|
||||
const { getRole } = interaction.client;
|
||||
let SupportStaff = await getRole(supportbot.Staff, interaction.guild);
|
||||
let Admin = await getRole(supportbot.Admin, interaction.guild);
|
||||
if (!SupportStaff || !Admin)
|
||||
return interaction.reply(
|
||||
"Some roles seem to be missing!\nPlease check for errors when starting the bot."
|
||||
);
|
||||
|
||||
let botCommands = "";
|
||||
botCommands += `**/${cmdconfig.HelpCommand}** ${cmdconfig.HelpCommandDesc}\n`;
|
||||
botCommands += `**/${cmdconfig.InfoCommand}** ${cmdconfig.InfoCommandDesc}\n`;
|
||||
botCommands += `**/${cmdconfig.PingCommand}** ${cmdconfig.PingCommandDesc}\n`;
|
||||
botCommands += `**/${cmdconfig.UserInfoCommand}** ${cmdconfig.UserInfoCommandDesc}\n`;
|
||||
|
||||
if (supportbot.DisableSuggestions === false) {
|
||||
botCommands += `**/${cmdconfig.SuggestCommand}** ${cmdconfig.SuggestCommandDesc}\n`;
|
||||
}
|
||||
|
||||
let ticketCommands = "";
|
||||
ticketCommands += `**/${cmdconfig.OpenTicket}** ${cmdconfig.OpenTicketDesc}\n`;
|
||||
ticketCommands += `**/${cmdconfig.CloseTicket}** ${cmdconfig.CloseTicketDesc}\n`;
|
||||
|
||||
let staffCommands = "";
|
||||
staffCommands += `**/${cmdconfig.TicketAdd}** ${cmdconfig.TicketAddDesc}\n`;
|
||||
staffCommands += `**/${cmdconfig.TicketRemove}** ${cmdconfig.TicketRemoveDesc}\n`;
|
||||
staffCommands += `**/${cmdconfig.UserInfoCommand}** ${cmdconfig.UserInfoCommandDesc}\n`;
|
||||
staffCommands += `**/${cmdconfig.TranslateCommand}** ${cmdconfig.TranslateCommandDesc}\n`;
|
||||
|
||||
const HelpEmbed1 = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.Name + " Commands")
|
||||
.setThumbnail(interaction.user.displayAvatarURL())
|
||||
|
||||
.addFields(
|
||||
{
|
||||
name: "🖥️ General Commands\n",
|
||||
value: `${botCommands}\n`,
|
||||
inline: false,
|
||||
},
|
||||
{
|
||||
name: "🎫 Support Commands\n",
|
||||
value: `${ticketCommands}\n`,
|
||||
inline: false,
|
||||
}
|
||||
)
|
||||
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter({
|
||||
text: supportbot.EmbedFooter,
|
||||
iconURL: interaction.user.displayAvatarURL(),
|
||||
});
|
||||
|
||||
if (
|
||||
interaction.member.roles.cache.has(SupportStaff.id) ||
|
||||
interaction.member.roles.cache.has(Admin.id)
|
||||
) {
|
||||
HelpEmbed1.addFields({
|
||||
name: "🔐 Staff Commands\n",
|
||||
value: `${staffCommands}\n`,
|
||||
inline: false,
|
||||
});
|
||||
}
|
||||
|
||||
interaction.reply({
|
||||
ephemeral: true,
|
||||
embeds: [HelpEmbed1],
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,40 @@
|
||||
// SupportBot | Emerald Services
|
||||
// Info Command
|
||||
|
||||
const fs = require("fs");
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(
|
||||
fs.readFileSync("./Configs/supportbot.yml", "utf8")
|
||||
);
|
||||
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
|
||||
|
||||
const Command = require("../Structures/Command.js");
|
||||
|
||||
module.exports = new Command({
|
||||
name: cmdconfig.InfoCommand,
|
||||
description: cmdconfig.InfoCommandDesc,
|
||||
options: [],
|
||||
permissions: ["SEND_MESSAGES"],
|
||||
|
||||
async run(interaction) {
|
||||
const InfoButton = new Discord.MessageButton()
|
||||
.setLabel(supportbot.InfoButtonText)
|
||||
.setURL(supportbot.InfoURL)
|
||||
.setStyle("LINK");
|
||||
|
||||
const inforow = new Discord.MessageActionRow().addComponents(InfoButton);
|
||||
|
||||
const InfoEmbed = new Discord.MessageEmbed()
|
||||
.setURL(supportbot.InfoURL)
|
||||
.setTitle(supportbot.InfoTitle)
|
||||
.setDescription(supportbot.AboutMe)
|
||||
.setColor(supportbot.InfoColour);
|
||||
|
||||
interaction.reply({
|
||||
embeds: [InfoEmbed],
|
||||
components: [inforow],
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,32 @@
|
||||
// SupportBot | Emerald Services
|
||||
// Ping Command
|
||||
|
||||
const fs = require("fs");
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(
|
||||
fs.readFileSync("./Configs/supportbot.yml", "utf8")
|
||||
);
|
||||
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
|
||||
|
||||
const Command = require("../Structures/Command.js");
|
||||
|
||||
module.exports = new Command({
|
||||
name: cmdconfig.PingCommand,
|
||||
description: cmdconfig.PingCommandDesc,
|
||||
options: [],
|
||||
permissions: ["SEND_MESSAGES"],
|
||||
|
||||
async run(interaction) {
|
||||
const PingEmbed = new Discord.MessageEmbed()
|
||||
.setDescription(
|
||||
`:ping_pong: **Ping:** \`${interaction.client.ws.ping} ms\``
|
||||
)
|
||||
.setColor(supportbot.EmbedColour);
|
||||
|
||||
interaction.reply({
|
||||
embeds: [PingEmbed],
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,94 @@
|
||||
// SupportBot | Emerald Services
|
||||
// Ticket Remove Command
|
||||
|
||||
const fs = require("fs");
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(
|
||||
fs.readFileSync("./Configs/supportbot.yml", "utf8")
|
||||
);
|
||||
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
|
||||
|
||||
const Command = require("../Structures/Command.js");
|
||||
|
||||
module.exports = new Command({
|
||||
name: cmdconfig.TicketRemove,
|
||||
description: cmdconfig.TicketRemoveDesc,
|
||||
options: [
|
||||
{
|
||||
name: "user",
|
||||
description: "User to remove",
|
||||
type: "USER",
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
permissions: ["SEND_MESSAGES"],
|
||||
|
||||
async run(interaction) {
|
||||
const { getRole } = interaction.client;
|
||||
let Staff = await getRole(supportbot.Staff, interaction.guild);
|
||||
let Admin = await getRole(supportbot.Admin, interaction.guild);
|
||||
if (!Staff || !Admin)
|
||||
return interaction.reply(
|
||||
"Some roles seem to be missing!\nPlease check for errors when starting the bot."
|
||||
);
|
||||
|
||||
const NoPerms = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Permissions!")
|
||||
.setDescription(
|
||||
`${supportbot.IncorrectPerms}\n\nRole Required: \`${supportbot.Staff}\` or \`${supportbot.Admin}\``
|
||||
)
|
||||
.setColor(supportbot.WarningColour);
|
||||
|
||||
if (
|
||||
!interaction.member.roles.cache.has(Staff.id) &&
|
||||
!interaction.member.roles.cache.has(Admin.id)
|
||||
)
|
||||
return interaction.reply({ embeds: [NoPerms] });
|
||||
let TicketData = await JSON.parse(
|
||||
fs.readFileSync("./Data/TicketData.json", "utf8")
|
||||
);
|
||||
let ticket = await TicketData.tickets.findIndex(
|
||||
(t) => t.id === interaction.channel.id
|
||||
);
|
||||
if (ticket === -1) {
|
||||
const Exists = new Discord.MessageEmbed()
|
||||
.setTitle("No Ticket Found!")
|
||||
.setDescription(supportbot.NoValidTicket)
|
||||
.setColor(supportbot.WarningColour);
|
||||
return interaction.reply({ ephemeral: true, embeds: [Exists] });
|
||||
}
|
||||
|
||||
let uMember = interaction.options.getUser("user");
|
||||
const UserNotExist = new Discord.MessageEmbed()
|
||||
.setTitle("User Not Found!")
|
||||
.setDescription(
|
||||
`${supportbot.UserNotFound}\n\nTry Again:\`/${cmdconfig.TicketRemove} <user#0000>\``
|
||||
)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
|
||||
if (!uMember) return interaction.reply({ ephemeral: true, embeds: [UserNotExist] });
|
||||
|
||||
await interaction.channel.permissionOverwrites.edit(uMember.id, {
|
||||
VIEW_CHANNEL: false,
|
||||
});
|
||||
|
||||
const Complete = new Discord.MessageEmbed()
|
||||
.setTitle("User Removed!")
|
||||
.setDescription(supportbot.RemovedUser.replace(/%user%/g, uMember.id))
|
||||
.setTimestamp()
|
||||
.setColor(supportbot.EmbedColour);
|
||||
interaction.reply({ embeds: [Complete] });
|
||||
TicketData.tickets[ticket].subUsers = TicketData.tickets[
|
||||
ticket
|
||||
].subUsers.filter((u) => u !== uMember.id);
|
||||
fs.writeFileSync(
|
||||
"./Data/TicketData.json",
|
||||
JSON.stringify(TicketData, null, 4),
|
||||
(err) => {
|
||||
if (err) console.error(err);
|
||||
}
|
||||
);
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,84 @@
|
||||
// SupportBot | Emerald Services
|
||||
// Suggest Command
|
||||
|
||||
const fs = require("fs");
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(
|
||||
fs.readFileSync("./Configs/supportbot.yml", "utf8")
|
||||
);
|
||||
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
|
||||
|
||||
const Command = require("../Structures/Command.js");
|
||||
|
||||
module.exports = new Command({
|
||||
name: cmdconfig.SuggestCommand,
|
||||
description: cmdconfig.SuggestCommandDesc,
|
||||
options: [
|
||||
{
|
||||
name: "suggestion",
|
||||
description: "Create a Suggestion",
|
||||
type: "STRING",
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
permissions: ["SEND_MESSAGES"],
|
||||
|
||||
async run(interaction) {
|
||||
const { getChannel } = interaction.client;
|
||||
const suggestChannel = await getChannel(
|
||||
supportbot.SuggestionChannel,
|
||||
interaction.guild
|
||||
);
|
||||
|
||||
const NoChannel = new Discord.MessageEmbed()
|
||||
.setTitle("Missing Channel!")
|
||||
.setDescription(supportbot.InvalidChannel)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
|
||||
if (!suggestChannel) return interaction.reply({ embeds: [NoChannel] });
|
||||
|
||||
let suggestion = interaction.options.getString("suggestion");
|
||||
|
||||
const SuggestEmbed = new Discord.MessageEmbed()
|
||||
.addField("Suggestion", suggestion, true)
|
||||
.addField("From", `<@${interaction.user.id}>`)
|
||||
.setThumbnail(interaction.user.displayAvatarURL())
|
||||
.setFooter({
|
||||
text: supportbot.EmbedFooter,
|
||||
iconURL: interaction.user.displayAvatarURL(),
|
||||
})
|
||||
.setColor(supportbot.EmbedColour);
|
||||
|
||||
const suggestionMsg = await suggestChannel.send({ embeds: [SuggestEmbed] });
|
||||
if (supportbot.SuggestionUpvote && supportbot.SuggestionDownvote) {
|
||||
await suggestionMsg.react(supportbot.SuggestionUpvote);
|
||||
await suggestionMsg.react(supportbot.SuggestionDownvote);
|
||||
|
||||
if (supportbot.SuggestionThreads) {
|
||||
await suggestionMsg.startThread({
|
||||
name: `Suggestion-releated Thread`,
|
||||
autoArchiveDuration: 60,
|
||||
type: 'GUILD_PUBLIC_THREAD',
|
||||
reason: 'Suggestion-releated thread',
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
const Submitted = new Discord.MessageEmbed()
|
||||
.setTitle("Suggestion Submitted!")
|
||||
.setDescription(
|
||||
`:white_check_mark: You have successfully submitted a suggestion.`
|
||||
)
|
||||
.addField("Sent to:", `<#${suggestChannel.id}>`)
|
||||
.setColor(supportbot.SuccessColour);
|
||||
|
||||
return interaction.reply({
|
||||
ephemeral: true,
|
||||
embeds: [Submitted]
|
||||
})
|
||||
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,329 @@
|
||||
// SupportBot | Emerald Services
|
||||
// Ticket Command
|
||||
|
||||
const fs = require("fs");
|
||||
|
||||
const {
|
||||
MessageEmbed,
|
||||
Permissions,
|
||||
MessageButton,
|
||||
MessageActionRow,
|
||||
} = require("discord.js");
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(
|
||||
fs.readFileSync("./Configs/supportbot.yml", "utf8")
|
||||
);
|
||||
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
|
||||
|
||||
const Command = require("../Structures/Command.js");
|
||||
const TicketNumberID = require("../Structures/TicketID.js");
|
||||
|
||||
module.exports = new Command({
|
||||
name: cmdconfig.OpenTicket,
|
||||
description: cmdconfig.OpenTicketDesc,
|
||||
options: [
|
||||
{
|
||||
name: "reason",
|
||||
description: "Ticket Reason",
|
||||
type: "STRING",
|
||||
},
|
||||
],
|
||||
permissions: ["SEND_MESSAGES"],
|
||||
|
||||
async run(interaction) {
|
||||
let disableCommand = true;
|
||||
if (interaction.isCommand() && disableCommand)
|
||||
return interaction.reply({
|
||||
content: "This command is disabled",
|
||||
ephemeral: true,
|
||||
});
|
||||
let department = interaction.customId?.split("-")[1] || null;
|
||||
let TicketData = await JSON.parse(
|
||||
fs.readFileSync("./Data/TicketData.json", "utf8")
|
||||
);
|
||||
const { getRole, getCategory } = interaction.client;
|
||||
let User = interaction.guild.members.cache.get(interaction.user.id);
|
||||
|
||||
if (
|
||||
supportbot.MaxAllowedTickets &&
|
||||
TicketData.tickets.filter((t) => t.user === interaction.user.id && t.open)
|
||||
.length >= supportbot.MaxAllowedTickets
|
||||
) {
|
||||
return interaction.reply({
|
||||
embeds: [
|
||||
{
|
||||
title: "Too Many Tickets!",
|
||||
description: `You can't have more than ${supportbot.MaxAllowedTickets} open tickets!`,
|
||||
color: supportbot.WarningColour,
|
||||
},
|
||||
],
|
||||
ephemeral: true,
|
||||
});
|
||||
}
|
||||
if (
|
||||
User.roles.cache.has(
|
||||
getRole(supportbot.TicketBlackListRole, interaction.guild).id
|
||||
)
|
||||
) {
|
||||
return interaction.reply({
|
||||
content: supportbot.TicketBlackListMessage,
|
||||
ephemeral: true,
|
||||
});
|
||||
}
|
||||
|
||||
// Ticket ID
|
||||
let ticketNumberID = await TicketNumberID.pad();
|
||||
|
||||
// Ticket Subject
|
||||
const TicketSubject =
|
||||
interaction.options?.getString("reason") || supportbot.NoTicketSubject;
|
||||
|
||||
const TicketExists = new MessageEmbed()
|
||||
.setTitle("Ticket Exists!")
|
||||
.setDescription(supportbot.TicketExists);
|
||||
|
||||
if (
|
||||
await interaction.guild.channels.cache.find(
|
||||
(ticketChannel) =>
|
||||
ticketChannel.name === `${supportbot.TicketPrefix}${ticketNumberID}`
|
||||
)
|
||||
) {
|
||||
return await interaction.reply({
|
||||
embeds: [TicketExists],
|
||||
ephemeral: true,
|
||||
});
|
||||
}
|
||||
const Staff = await getRole(supportbot.Staff, interaction.guild);
|
||||
const Admin = await getRole(supportbot.Admin, interaction.guild);
|
||||
if (!Staff || !Admin)
|
||||
return interaction.reply({
|
||||
content:
|
||||
"Some roles seem to be missing!\nPlease check for errors when starting the bot.",
|
||||
ephemeral: true,
|
||||
});
|
||||
let TicketCategory = await getCategory(
|
||||
supportbot.Departments[department].category,
|
||||
interaction.guild
|
||||
);
|
||||
const ticketChannel = await interaction.guild.channels.create(
|
||||
`${supportbot.TicketPrefix}${ticketNumberID}`,
|
||||
{
|
||||
type: "GUILD_TEXT",
|
||||
parent: TicketCategory.id,
|
||||
permissionOverwrites: [
|
||||
{
|
||||
id: Admin.id,
|
||||
allow: [Permissions.FLAGS.VIEW_CHANNEL],
|
||||
},
|
||||
{
|
||||
id: interaction.user.id,
|
||||
allow: [Permissions.FLAGS.VIEW_CHANNEL],
|
||||
},
|
||||
{
|
||||
id: interaction.guild.id,
|
||||
deny: [Permissions.FLAGS.VIEW_CHANNEL],
|
||||
},
|
||||
],
|
||||
}
|
||||
);
|
||||
if (supportbot.AllowAllStaff) {
|
||||
await ticketChannel.permissionOverwrites.edit(Staff.id, {
|
||||
VIEW_CHANNEL: true,
|
||||
});
|
||||
}
|
||||
if (!department) {
|
||||
await ticketChannel.permissionOverwrites.edit(interaction.user.id, {
|
||||
SEND_MESSAGES: false,
|
||||
});
|
||||
}
|
||||
await TicketData.tickets.push({
|
||||
id: ticketChannel.id,
|
||||
name: ticketChannel.name,
|
||||
user: interaction.user.id,
|
||||
number: ticketNumberID,
|
||||
reason: TicketSubject,
|
||||
open: true,
|
||||
subUsers: [],
|
||||
});
|
||||
fs.writeFileSync(
|
||||
"./Data/TicketData.json",
|
||||
JSON.stringify(TicketData, null, 4),
|
||||
(err) => {
|
||||
if (err) console.error(err);
|
||||
}
|
||||
);
|
||||
|
||||
const CreatedTicket = new MessageEmbed()
|
||||
.setDescription(
|
||||
supportbot.TicketCreatedAlert.replace(
|
||||
/%ticketauthor%/g,
|
||||
interaction.user.id
|
||||
)
|
||||
.replace(/%ticketid%/g, ticketChannel.id)
|
||||
.replace(/%ticketusername%/g, interaction.user.username)
|
||||
)
|
||||
.setColor(supportbot.EmbedColour);
|
||||
await interaction.reply({ embeds: [CreatedTicket], ephemeral: true });
|
||||
|
||||
if (supportbot.AllowTicketMentions) {
|
||||
await ticketChannel.send(`${interaction.user}`);
|
||||
}
|
||||
|
||||
const TicketMessage = new MessageEmbed()
|
||||
.setTitle(
|
||||
supportbot.Ticket_Title.replace(/%ticketauthor%/g, interaction.user.id)
|
||||
.replace(/%ticketid%/g, ticketChannel.id)
|
||||
.replace(/%ticketusername%/g, interaction.user.username)
|
||||
)
|
||||
.setDescription(
|
||||
supportbot.TicketMessage.replace(/%ticketauthor%/g, interaction.user.id)
|
||||
.replace(/%ticketid%/g, ticketChannel.id)
|
||||
.replace(/%ticketusername%/g, interaction.user.username)
|
||||
)
|
||||
.setColor(supportbot.EmbedColour);
|
||||
|
||||
if (supportbot.TicketSubject === "embed") {
|
||||
if (TicketSubject !== "No Reason Provided.") {
|
||||
TicketMessage.addFields({ name: "Reason", value: TicketSubject });
|
||||
}
|
||||
}
|
||||
|
||||
if (supportbot.TicketSubject === "description") {
|
||||
if (TicketSubject !== "No Reason Provided.") {
|
||||
await ticketChannel.setTopic(
|
||||
`Reason: ${TicketSubject} - User ID: ${interaction.user.id} - Ticket: ${ticketChannel.name}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!department) {
|
||||
TicketMessage.addFields({
|
||||
name: "Departments",
|
||||
value: ` **${supportbot.Departments.map((X) => X.title).join("\n")}**`,
|
||||
});
|
||||
}
|
||||
const CloseButton = new MessageButton()
|
||||
.setCustomId("ticketclose")
|
||||
.setLabel("Close")
|
||||
.setStyle(supportbot.TicketCloseColour)
|
||||
.setEmoji(supportbot.TicketCloseEmoji);
|
||||
|
||||
const LockButton = new MessageButton()
|
||||
.setCustomId("ticketlock")
|
||||
.setLabel("Lock")
|
||||
.setStyle(supportbot.TicketLockColour)
|
||||
.setEmoji(supportbot.TicketLockEmoji);
|
||||
|
||||
const row2 = new MessageActionRow().addComponents(CloseButton, LockButton);
|
||||
if (!department) {
|
||||
try {
|
||||
let buttons = await supportbot.Departments.map((x) =>
|
||||
new MessageButton()
|
||||
.setCustomId("Department" + supportbot.Departments.indexOf(x))
|
||||
.setLabel(x.title)
|
||||
.setStyle(x.color)
|
||||
.setEmoji(x.emoji)
|
||||
);
|
||||
const row = new MessageActionRow().addComponents(buttons);
|
||||
const m = await ticketChannel.send({
|
||||
embeds: [TicketMessage],
|
||||
components: [row],
|
||||
});
|
||||
|
||||
let collector;
|
||||
try {
|
||||
const filter = (i) => i.user.id === interaction.user.id;
|
||||
collector = await m.awaitMessageComponent({
|
||||
filter,
|
||||
max: 1,
|
||||
componentType: "BUTTON",
|
||||
time: supportbot.Timeout * 60000,
|
||||
});
|
||||
} catch (e) {
|
||||
if (e.code === "INTERACTION_COLLECTOR_ERROR") {
|
||||
try {
|
||||
TicketData = await JSON.parse(
|
||||
fs.readFileSync("./Data/TicketData.json", "utf8")
|
||||
);
|
||||
let ticket = await TicketData.tickets.findIndex(
|
||||
(t) => t.id === ticketChannel.id
|
||||
);
|
||||
TicketData.tickets[ticket].open = false;
|
||||
fs.writeFileSync(
|
||||
"./Data/TicketData.json",
|
||||
JSON.stringify(TicketData, null, 4),
|
||||
(err) => {
|
||||
if (err) console.error(err);
|
||||
}
|
||||
);
|
||||
interaction.user.send(
|
||||
"Your ticket has timed out. Please open a new one, and select a department."
|
||||
);
|
||||
} catch (e) {}
|
||||
return await ticketChannel.delete();
|
||||
}
|
||||
}
|
||||
let num = collector.customId.split("Department")[1];
|
||||
let role = getRole(supportbot.Departments[num].role, interaction.guild);
|
||||
let title = supportbot.Departments[num].title;
|
||||
|
||||
await ticketChannel.permissionOverwrites.edit(role.id, {
|
||||
VIEW_CHANNEL: true,
|
||||
});
|
||||
await ticketChannel.permissionOverwrites.edit(interaction.user.id, {
|
||||
SEND_MESSAGES: true,
|
||||
});
|
||||
|
||||
await collector.reply({
|
||||
embeds: [
|
||||
{
|
||||
description: `> Thank for reaching out to the **${title} Department**. Please provide us information regarding your query.`,
|
||||
color: supportbot.EmbedColour,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
if (supportbot.AllowTicketMentions) {
|
||||
await ticketChannel.send("@here");
|
||||
}
|
||||
await collector.message.edit({
|
||||
embeds: [TicketMessage],
|
||||
components: [row2],
|
||||
});
|
||||
} catch (error) {}
|
||||
} else {
|
||||
await ticketChannel.send({
|
||||
embeds: [TicketMessage],
|
||||
components: [row2],
|
||||
});
|
||||
if (department) {
|
||||
let role = await getRole(
|
||||
supportbot.Departments[department].role,
|
||||
interaction.guild
|
||||
);
|
||||
let title = supportbot.Departments[department].title;
|
||||
await ticketChannel.permissionOverwrites.edit(role.id, {
|
||||
VIEW_CHANNEL: true,
|
||||
});
|
||||
let TicketCat = await getCategory(
|
||||
supportbot.Departments[department].category,
|
||||
interaction.guild
|
||||
);
|
||||
await ticketChannel.setParent(TicketCat.id, { lockPermissions: false });
|
||||
if (supportbot.AllowThanksForReachingOutMessage) {
|
||||
await ticketChannel.send({
|
||||
embeds: [
|
||||
{
|
||||
description: `> Thank for reaching out to the **${title} Department**. Please provide us information regarding your query.`,
|
||||
color: supportbot.EmbedColour,
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
}
|
||||
if (supportbot.AllowTicketMentions) {
|
||||
await ticketChannel.send(supportbot.TicketRoleMention);
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,108 @@
|
||||
// SupportBot | Emerald Services
|
||||
// Translate Command
|
||||
|
||||
const fs = require("fs");
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(
|
||||
fs.readFileSync("./Configs/supportbot.yml", "utf8")
|
||||
);
|
||||
const cmdconfig = yaml.load(
|
||||
fs.readFileSync("./Configs/commands.yml", "utf8")
|
||||
);
|
||||
|
||||
const Command = require("../Structures/Command.js");
|
||||
const translate = require("@vitalets/google-translate-api");
|
||||
|
||||
module.exports = new Command({
|
||||
name: cmdconfig.TranslateCommand, // Name of command
|
||||
description: cmdconfig.TranslateCommandDesc, // Description of command
|
||||
options: [
|
||||
{
|
||||
type: "STRING",
|
||||
name: "language",
|
||||
description: "A 2 letter language code",
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
type: "STRING",
|
||||
name: "text",
|
||||
description: "The text to translate",
|
||||
required: true,
|
||||
}, // The input text for the translation
|
||||
],
|
||||
permissions: ["SEND_MESSAGES"], // The permission the user/role at least requires
|
||||
|
||||
async run(interaction) {
|
||||
|
||||
const { getRole } = interaction.client;
|
||||
let SupportStaff = await getRole(supportbot.Staff, interaction.guild);
|
||||
let Admin = await getRole(supportbot.Admin, interaction.guild);
|
||||
if (!SupportStaff || !Admin)
|
||||
return interaction.reply(
|
||||
"Some roles seem to be missing!\nPlease check the error logs."
|
||||
);
|
||||
|
||||
const NoPerms = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Permissions!")
|
||||
.setDescription(
|
||||
`${supportbot.IncorrectPerms}\n\nRole Required: \`${supportbot.Staff}\` or \`${supportbot.Admin}\``
|
||||
)
|
||||
.setColor(supportbot.WarningColour);
|
||||
|
||||
if (
|
||||
!interaction.member.roles.cache.has(SupportStaff.id) &&
|
||||
!interaction.member.roles.cache.has(Admin.id)
|
||||
)
|
||||
return interaction.reply({ embeds: [NoPerms] });
|
||||
|
||||
const { getChannel } = interaction.client;
|
||||
let lang = interaction.options.getString("language"); // Grab choice of language code by user
|
||||
let url = "https://www.science.co.il/language/Codes.php"; // URL to all available language codes
|
||||
let text = await interaction.options.getString("text"); // Grab the text to translate by the user
|
||||
let translatelog = await getChannel(
|
||||
supportbot.TranslateLogChannel,
|
||||
interaction.guild
|
||||
); // Grab the set logging channel for translations
|
||||
|
||||
|
||||
// Return message if user has provided an invalid language code
|
||||
const result = await translate(text, { to: lang }).catch(async (err) => {
|
||||
if (err && err.code == 400) {
|
||||
await interaction.reply({
|
||||
embeds: [
|
||||
new Discord.MessageEmbed()
|
||||
.setColor(supportbot.WarningColour)
|
||||
.setTitle("Valid Language Codes")
|
||||
.setURL(url)
|
||||
.setDescription(
|
||||
"Click the title to see which 2 letter language codes are valid."
|
||||
),
|
||||
],
|
||||
ephemeral: true,
|
||||
});
|
||||
}
|
||||
});
|
||||
if (!result) return;
|
||||
|
||||
// Embed containing language code, original text and translated text
|
||||
let transembed = new Discord.MessageEmbed()
|
||||
.setAuthor({ name: interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ dynamic: true }) })
|
||||
.setColor(supportbot.SuccessColour)
|
||||
.setDescription(`**Translation to ${lang}**`)
|
||||
.addFields(
|
||||
{ name: "Original text", value: text },
|
||||
{ name: "Translated text", value: result.text },
|
||||
)
|
||||
.setFooter({ text: `Author: ${interaction.user.id}` })
|
||||
.setTimestamp();
|
||||
|
||||
// Send embed [transembed] with translated message to channel
|
||||
await interaction.reply({ embeds: [transembed] });
|
||||
|
||||
// Send embed [transembed] to logging channel
|
||||
await translatelog.send({ embeds: [transembed] });
|
||||
},
|
||||
|
||||
})
|
||||
@@ -0,0 +1,127 @@
|
||||
// SupportBot | Emerald Services
|
||||
// User Info Command
|
||||
|
||||
const fs = require("fs");
|
||||
const moment = require("moment");
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(
|
||||
fs.readFileSync("./Configs/supportbot.yml", "utf8")
|
||||
);
|
||||
const cmdconfig = yaml.load(
|
||||
fs.readFileSync("./Configs/commands.yml", "utf8")
|
||||
);
|
||||
|
||||
const Command = require("../Structures/Command.js");
|
||||
|
||||
module.exports = new Command({
|
||||
name: cmdconfig.UserInfoCommand, // Name of command
|
||||
description: cmdconfig.UserInfoCommandDesc, // Description of command
|
||||
options: [
|
||||
{
|
||||
type: "USER",
|
||||
name: "user",
|
||||
description: "The user you want to get info about.",
|
||||
required: true,
|
||||
}, // The user input
|
||||
],
|
||||
permissions: ["SEND_MESSAGES"], // The permission the user/role at least requires
|
||||
|
||||
async run(interaction) {
|
||||
const { getRole } = interaction.client;
|
||||
let SupportStaff = await getRole(supportbot.Staff, interaction.guild);
|
||||
let Admin = await getRole(supportbot.Admin, interaction.guild);
|
||||
if (!SupportStaff || !Admin)
|
||||
return interaction.reply(
|
||||
"Some roles seem to be missing!\nPlease check the error logs."
|
||||
);
|
||||
|
||||
const NoPerms = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Permissions!")
|
||||
.setDescription(
|
||||
`${supportbot.IncorrectPerms}\n\nRole Required: \`${supportbot.Staff}\` or \`${supportbot.Admin}\``
|
||||
)
|
||||
.setColor(supportbot.WarningColour);
|
||||
|
||||
if (
|
||||
!interaction.member.roles.cache.has(SupportStaff.id) &&
|
||||
!interaction.member.roles.cache.has(Admin.id)
|
||||
)
|
||||
return interaction.reply({ embeds: [NoPerms] });
|
||||
|
||||
let user = await interaction.options.getUser("user") || interaction.author; // Grab the mentioned user
|
||||
let member = await interaction.guild.members.cache.get(user.id) // Check for user and his ID
|
||||
|
||||
const UserNotExist = new Discord.MessageEmbed()
|
||||
.setTitle("User Not Found!")
|
||||
.setDescription(
|
||||
`${supportbot.UserNotFound}\n\nTry Again:\`/${cmdconfig.UserInfoCommand} <@!User_ID> or @User\``
|
||||
)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
|
||||
if (!user) return interaction.reply({ embeds: [UserNotExist] });
|
||||
|
||||
// Flags a user/bot can have
|
||||
const flags = {
|
||||
DISCORD_EMPLOYEE: 'Discord Employee',
|
||||
DISCORD_PARTNER: 'Discord Partner',
|
||||
BUGHUNTER_LEVEL_1: 'Bug Hunter (Level 1)',
|
||||
BUGHUNTER_LEVEL_2: 'Bug Hunter (Level 2)',
|
||||
HYPESQUAD_EVENTS: 'HypeSquad Events',
|
||||
HOUSE_BRAVERY: 'House of Bravery',
|
||||
HOUSE_BRILLIANCE: 'House of Brilliance',
|
||||
HOUSE_BALANCE: 'House of Balance',
|
||||
EARLY_SUPPORTER: 'Early Supporter',
|
||||
TEAM_USER: 'Team User',
|
||||
SYSTEM: 'System',
|
||||
VERIFIED_BOT: 'Verified Bot',
|
||||
VERIFIED_DEVELOPER: 'Verified Bot Developer'
|
||||
};
|
||||
|
||||
// Status message with icon
|
||||
let status = {
|
||||
online: "🟢Online",
|
||||
idle: "🟡Idle",
|
||||
dnd: "🔴Do Not Disturb",
|
||||
offline: "⚫Offline"
|
||||
};
|
||||
|
||||
const userFlags = user.flags.toArray();
|
||||
|
||||
// Embed containing the userinfo
|
||||
let userembed = new Discord.MessageEmbed()
|
||||
.setTitle(`User Info for User: ${user.tag}`)
|
||||
.setThumbnail(member.displayAvatarURL({ dynamic: true, size: 512 }))
|
||||
.setColor(member.roles.highest.hexColor)
|
||||
.addFields(
|
||||
{ name: "Name:", value: `${user.tag}\n<@${member.id}>`, inline: true },
|
||||
{ name: "ID:", value: `${member.id}`, inline: true },
|
||||
{ name: "Is Bot:", value: user.bot ? "Yes" : "No", inline: true },
|
||||
{ name: "House/Badge:", value: `${userFlags.length ? userFlags.map(flag => flags[flag]).join("\n") : "None"}`, inline: true },
|
||||
{ name: "Current Status:", value: `${status[member.presence ? member.presence.status : "offline"]}`, inline: true },
|
||||
{ name: "Avatar URL:", value: `[Click Here](${member.displayAvatarURL()})`, inline: true },
|
||||
{ name: "\u200b", value: "\u200b", inline: false}
|
||||
)
|
||||
.addFields(
|
||||
{ name: "Creation Date:", value: `${moment(user.createdAt).format("MMMM Do YYYY, h:mm:ss a")}\n> ${moment(user.createdAt).startOf("day").fromNow()}`, inline: true },
|
||||
{ name: "Joined Date:", value: `${moment(member.joinedAt).format("MMMM Do YYYY, h:mm:ss a")}\n> ${moment(member.joinedAt).startOf("day").fromNow()}`, inline: true },
|
||||
{ name: "Roles Total:", value: `${member.roles.cache.size -1}`, inline: false },
|
||||
{ name: "Highest Role:", value: `${member.roles.highest.id === interaction.guild.id ? "None" : member.roles.highest.toString()}`, inline: true },
|
||||
{ name: "Roles:", value: `${member.roles.cache.map(r => r).join(" ").replace("@everyone", " ") || "None"}`, inline: false },
|
||||
)
|
||||
.setFooter({ text: supportbot.EmbedFooter })
|
||||
.setTimestamp();
|
||||
|
||||
// Send embed [userembed]
|
||||
await interaction.reply({ embeds: [userembed] }).catch((err) => console.error("An error has occured: ", err));
|
||||
|
||||
},
|
||||
})
|
||||
|
||||
/**
|
||||
* @INFO
|
||||
* UserInfo command by Sypher#3415 | 321332200668790786
|
||||
* @INFO
|
||||
* Solely created for SupportBot | https://github.com/Emerald-Services/SupportBot/
|
||||
**/
|
||||
@@ -0,0 +1,45 @@
|
||||
# ___ _ ___ _
|
||||
# / __> _ _ ___ ___ ___ _ _ _| |_ | . > ___ _| |_
|
||||
# \__ \| | || . \| . \/ . \| '_> | | | . \/ . \ | |
|
||||
# <___/`___|| _/| _/\___/|_| |_| |___/\___/ |_|
|
||||
# |_| |_|
|
||||
#
|
||||
# SupportBot created by Emerald Services
|
||||
# Installed with MIT License
|
||||
#
|
||||
# Discord Support: https://emeraldsrv.dev/discord
|
||||
# Community Resources: https://emeraldsrv.dev/resources
|
||||
|
||||
# -------------------------------
|
||||
# Command Name Configuration
|
||||
# -------------------------------
|
||||
|
||||
Blacklist: "blacklist"
|
||||
TicketAdd: "add"
|
||||
TicketRemove: "remove"
|
||||
OpenTicket: "ticket"
|
||||
CloseTicket: "close"
|
||||
InfoCommand: "info"
|
||||
PingCommand: "ping"
|
||||
HelpCommand: "help"
|
||||
EmbedCommand: "embed"
|
||||
SuggestCommand: "suggest"
|
||||
TranslateCommand: "translate"
|
||||
UserInfoCommand: "userinfo"
|
||||
|
||||
# ---------------------------------------
|
||||
# Command Description Configuration
|
||||
# ---------------------------------------
|
||||
|
||||
BlacklistDesc: "Blacklist a user from creating Tickets."
|
||||
TicketAddDesc: "Add a user to a support ticket."
|
||||
TicketRemoveDesc: "Remove a user from a support ticket."
|
||||
TranslateCommandDesc: "Translates the language provided, along with the abbreviation (2 char) long language code"
|
||||
OpenTicketDesc: "Open a new support ticket."
|
||||
CloseTicketDesc: "Close your support ticket."
|
||||
InfoCommandDesc: "Get information about the brand."
|
||||
PingCommandDesc: "Pong!"
|
||||
HelpCommandDesc: "Get a list of all the commands."
|
||||
EmbedCommandDesc: "Send a message as an embed."
|
||||
SuggestCommandDesc: "Suggest a feature for the server."
|
||||
UserInfoCommandDesc: "Get info about a user."
|
||||
@@ -0,0 +1,260 @@
|
||||
# ___ _ ___ _
|
||||
# / __> _ _ ___ ___ ___ _ _ _| |_ | . > ___ _| |_
|
||||
# \__ \| | || . \| . \/ . \| '_> | | | . \/ . \ | |
|
||||
# <___/`___|| _/| _/\___/|_| |_| |___/\___/ |_|
|
||||
# |_| |_|
|
||||
#
|
||||
# SupportBot created by Emerald Services
|
||||
# Installed with MIT License
|
||||
#
|
||||
# Discord Support: https://emeraldsrv.dev/discord
|
||||
# Community Resources: https://emeraldsrv.dev/resources
|
||||
|
||||
SupportBot_Version: "v7.7"
|
||||
|
||||
# -------------------------
|
||||
# General Configuration
|
||||
# -------------------------
|
||||
|
||||
Name: "SupportBot"
|
||||
Token: "BOT_TOKEN HTTPS://DISCORD.COM/DEVELOPERS"
|
||||
|
||||
# -------------------------
|
||||
# Activity Configuration
|
||||
# -------------------------
|
||||
|
||||
BotActivity: "Here to help!"
|
||||
|
||||
StreamingURL: "https://www.twitch.tv/YOUR_TWITCH_NAME"
|
||||
# Set The ActivityType to "STREAMING" for a streaming status!
|
||||
|
||||
ActivityType: "PLAYING"
|
||||
# Activity status can either be PLAYING, WATCHING, LISTENING or STREAMING.
|
||||
|
||||
# -------------------------
|
||||
# Embed Configuration
|
||||
# -------------------------
|
||||
|
||||
EmbedColour: "#f74343"
|
||||
EmbedFooter: "SupportBot | Developed by Emerald Services"
|
||||
|
||||
ErrorColour: "#d12519"
|
||||
SuccessColour: "#04b545"
|
||||
WarningColour: "#fca117"
|
||||
|
||||
# -------------------------
|
||||
# Role Configuration
|
||||
# -------------------------
|
||||
|
||||
AutoRole: true
|
||||
JoinRole: "Member"
|
||||
|
||||
Staff: "Staff"
|
||||
Admin: "Admin"
|
||||
TicketBlackListRole: "Blacklisted"
|
||||
|
||||
# ----------------------------
|
||||
# Join/Leave Configuration
|
||||
# ----------------------------
|
||||
|
||||
Welcome: true
|
||||
# set to false to disable joining logs
|
||||
|
||||
WelcomeChannel: "join-leave-logs"
|
||||
WelcomeColour: "#f74343"
|
||||
WelcomeTitle: "User Joined!"
|
||||
WelcomeMessage: "%joined_user% has joined the server!"
|
||||
# Available Placeholders:
|
||||
# %joined_user% - Mentions the user who joined
|
||||
|
||||
EmbedWelcomeImage: true
|
||||
EmbedWelcomeImageURL: "https://media.discordapp.net/attachments/958247876344025108/986777740738986094/unknown.png"
|
||||
|
||||
EmbedWelcomeThumbnail: "BOT"
|
||||
# "USER" will display the user's profile picture.
|
||||
# "BOT" will display the bot's profile picture.
|
||||
# false to disable
|
||||
|
||||
Leave: true
|
||||
# set to false to disable leaving logs
|
||||
|
||||
LeaveChannel: "join-leave-logs"
|
||||
LeaveColour: "#f74343"
|
||||
LeaveTitle: "User Left!"
|
||||
LeaveMessage: "%joined_user% has left the server!"
|
||||
# Available Placeholders:
|
||||
# %joined_user% - Mentions the user who joined
|
||||
|
||||
EmbedLeaveImage: true
|
||||
EmbedLeaveImageURL: "https://cdn.discordapp.com/attachments/958247876344025108/986778170223120384/unknown.png"
|
||||
|
||||
EmbedLeaveThumbnail: false
|
||||
# "USER" will display the user's profile picture.
|
||||
# "BOT" will display the bot's profile picture.
|
||||
# false to disable
|
||||
|
||||
# -------------------------
|
||||
# Information Configuration
|
||||
# -------------------------
|
||||
|
||||
InfoTitle: "Information"
|
||||
|
||||
InfoButtonText: "Visit Site"
|
||||
AboutMe: "I am SupportBot"
|
||||
InfoURL: "https://emeraldsrv.dev"
|
||||
InfoColour: "#f74343"
|
||||
|
||||
# ----------------------------
|
||||
# Suggestions Configuration
|
||||
# ----------------------------
|
||||
|
||||
SuggestionChannel: "suggestions"
|
||||
SuggestionUpvote: "✅"
|
||||
SuggestionDownvote: "❌"
|
||||
|
||||
SuggestionThreads: true
|
||||
# set to false to disable threads being created from suggestions.
|
||||
|
||||
DisableSuggestions: false
|
||||
# Set to true to disable the suggestions feature.
|
||||
|
||||
# -------------------------
|
||||
# Translate Configuration
|
||||
# -------------------------
|
||||
|
||||
TranslateLogChannel: "translations-log"
|
||||
|
||||
# -------------------------
|
||||
# Tickets Configuration
|
||||
# -------------------------
|
||||
|
||||
TicketPrefix: "ticket-" # The prefix for ticket channel names
|
||||
|
||||
TicketLog: "ticket-data"
|
||||
TranscriptLog: "ticket-data"
|
||||
|
||||
DMTranscripts: true
|
||||
TranscriptTitle: "Ticket Transcript"
|
||||
TicketLog_Title: "Ticket Closed"
|
||||
TicketBlackListMessage: "You are not allowed to open a ticket"
|
||||
TicketRoleMention: "@here"
|
||||
# To ping a role: <@ROLE_ID>
|
||||
|
||||
MaxAllowedTickets: 2
|
||||
|
||||
TicketSubject: "description"
|
||||
# "description" will display the ticket reason within the channel description
|
||||
# "embed" will display the ticket reason within the ticket embed
|
||||
|
||||
AllowTicketMentions: true
|
||||
# Set to true to allow the ticket to mention the author and the support team.
|
||||
# Set false to dis-allow mentions within tickets.
|
||||
|
||||
AllowThanksForReachingOutMessage: true
|
||||
# Set to true to allow the "Thanks for reaching out Message" to be sent when the ticket is created
|
||||
DisableTicketLogChannel: false
|
||||
# Set to true to disable the requirement of the "TicketLog"
|
||||
# Set to true to also disable the ticket logs to be sent in the "TicketLogs" channel
|
||||
|
||||
# --- Creation Config ---
|
||||
# --- Start ---
|
||||
|
||||
# Available Placeholders:
|
||||
|
||||
# %ticketusername% - User who created the ticket.
|
||||
# <@%ticketauthor%> - Tags the user who created the ticket.
|
||||
# <#%ticketid%> - Mentions the ticket channel.
|
||||
|
||||
Ticket_Title: "Server Support | %ticketusername%"
|
||||
TicketMessage: "Hello <@%ticketauthor%>, Thank you for creating a support ticket\nPlease wait patiently whilst a member of our team reaches out to you."
|
||||
|
||||
Ticket_Thumbnail: "https://images.emojiterra.com/google/android-pie/512px/1f39f.png"
|
||||
NoTicketSubject: "No Reason Provided!"
|
||||
|
||||
TicketCreatedAlert: ":ticket: Your support ticket has been created: <#%ticketid%>"
|
||||
|
||||
AddedUser: "👍 <@%user%> has been added to this ticket"
|
||||
RemovedUser: "👍 <@%user%> has been removed from this ticket"
|
||||
|
||||
# -------------------------
|
||||
# Tickets Categories
|
||||
# -------------------------
|
||||
|
||||
Timeout: 5
|
||||
|
||||
# Set to true to allow all staff to access the ticket
|
||||
AllowAllStaff: false
|
||||
|
||||
# Ticket roles are the roles that will be able to gain access to tickets depending on what department has been chosen.
|
||||
|
||||
Departments:
|
||||
- title: "Support"
|
||||
role: "Staff"
|
||||
color: "SECONDARY"
|
||||
emoji: "1️⃣"
|
||||
category: "Tickets"
|
||||
|
||||
- title: "Billing Support"
|
||||
role: "Staff"
|
||||
color: "SECONDARY"
|
||||
emoji: "2️⃣"
|
||||
category: "Tickets"
|
||||
|
||||
- title: "Admin Team"
|
||||
role: "Admin"
|
||||
color: "SECONDARY"
|
||||
emoji: "3️⃣"
|
||||
category: "Tickets"
|
||||
|
||||
# - title: "Other"
|
||||
# role: "Staff"
|
||||
# color: "SECONDARY"
|
||||
# emoji: "3️⃣"
|
||||
# category: "Tickets"
|
||||
|
||||
# Discord Button Colour Selection
|
||||
# PRIMARY - Blurple
|
||||
# SECONDARY - Grey
|
||||
# DANGER - Red
|
||||
# SUCCESS - Green
|
||||
|
||||
# --- Buttons Config ---
|
||||
# --- Start ---
|
||||
|
||||
LockTicketCategory: "Archive"
|
||||
|
||||
TicketCloseEmoji: "❌"
|
||||
TicketDeleteEmoji: "⛔"
|
||||
TicketLockEmoji: "🔒"
|
||||
|
||||
TicketCloseColour: "DANGER"
|
||||
TicketDeleteColour: "DANGER"
|
||||
TicketLockColour: "PRIMARY"
|
||||
|
||||
# Discord Button Colour Selection
|
||||
# PRIMARY - Blue
|
||||
# SECONDARY - Grey
|
||||
# DANGER - Red
|
||||
# SUCCESS - Green
|
||||
|
||||
TranscriptSavedMessage: "📝 **Transcript Saved!**"
|
||||
TicketLockMessage: "❌ **Ticket Locked!**"
|
||||
TicketDeleteMessage: "⚠ **Ticket Deleting!**" # Tickets deleting after 5 seconds by default.
|
||||
|
||||
# --- Closing Config ---
|
||||
# --- Start ---
|
||||
|
||||
StaffOnly: true
|
||||
ClosingTicket: ":warning: You have requested to close your support ticket."
|
||||
ClosingConfirmation_Word: "confirm"
|
||||
CloseConfirmation: true
|
||||
|
||||
# ---------------------------
|
||||
# Error / Warning Messages
|
||||
# ---------------------------
|
||||
|
||||
IncorrectPerms: ":x: **Err!** You do not have the correct permissions to use this command."
|
||||
InvalidChannel: ":x: **Err!** Channel not found. Please create it!"
|
||||
UserNotFound: ":x: **Err!** This user doesn't exist, Are they in this server?"
|
||||
NoValidTicket: ":warning: You cannot execute this command here."
|
||||
TicketExists: ":warning: This ticket cannot be opened, It already exists!"
|
||||
@@ -0,0 +1,34 @@
|
||||
# ___ _ ___ _
|
||||
# / __> _ _ ___ ___ ___ _ _ _| |_ | . > ___ _| |_
|
||||
# \__ \| | || . \| . \/ . \| '_> | | | . \/ . \ | |
|
||||
# <___/`___|| _/| _/\___/|_| |_| |___/\___/ |_|
|
||||
# |_| |_|
|
||||
#
|
||||
# SupportBot created by Emerald Services
|
||||
# Installed with MIT License
|
||||
#
|
||||
# Discord Support: https://emeraldsrv.dev/discord
|
||||
# Community Resources: https://emeraldsrv.dev/resources
|
||||
|
||||
# -------------------------------
|
||||
# Ticket Panel Configuration
|
||||
# -------------------------------
|
||||
|
||||
TicketPanel: true
|
||||
|
||||
# ----------------------------------------
|
||||
# Ticket Panel Message Configuration
|
||||
# ----------------------------------------
|
||||
|
||||
Channel: "ticket-creation"
|
||||
|
||||
PanelTitle: "Need Help? Create a Support Ticket."
|
||||
PanelColour: "#f74343"
|
||||
|
||||
TicketPanel_Description: true
|
||||
TicketPanel_Thumbnail: true
|
||||
TicketPanel_Image: true
|
||||
|
||||
PanelMessage: "Click the button to open a new support ticket."
|
||||
PanelThumbnail: "https://i.imgur.com/ieeZejl.png"
|
||||
PanelImage: "https://i.imgur.com/5NkcmDq.png"
|
||||
BIN
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"tickets": [{}]}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"id": 0,
|
||||
"TicketPanelID": ""
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
const Event = require("../Structures/Event.js");
|
||||
module.exports = new Event("guildCreate", async (client) => {
|
||||
console.log(
|
||||
`\u001b[31m`,
|
||||
`${client.user.username} is not in the correct server set in your config. Please leave all other servers and restart the bot.`
|
||||
);
|
||||
console.log(`\u001b[31m`, `${client.user.username} will now exit.`);
|
||||
return process.exit(1);
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
const Event = require("../Structures/Event.js");
|
||||
|
||||
module.exports = new Event("guildDelete", async (client) => {
|
||||
console.log(
|
||||
`\u001b[31m`,
|
||||
`${client.user.username} is not in the correct server set in your config. Please join the server and restart the bot.`
|
||||
);
|
||||
console.log(`\u001b[31m`, `${client.user.username} will now exit.`);
|
||||
return process.exit(1);
|
||||
});
|
||||
@@ -0,0 +1,46 @@
|
||||
|
||||
const Discord = require('discord.js');
|
||||
const fs = require("fs");
|
||||
const Event = require("../Structures/Event.js");
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(
|
||||
fs.readFileSync("./Configs/supportbot.yml", "utf8")
|
||||
);
|
||||
|
||||
module.exports = new Event("guildMemberAdd", async (client, member, interaction, guild) => {
|
||||
|
||||
if (supportbot.Welcome) {
|
||||
const WelcomeChannel = member.guild.channels.cache.find(channel => channel.name === supportbot.WelcomeChannel)
|
||||
|
||||
const WelcomeEmbed = new Discord.MessageEmbed()
|
||||
.setColor(supportbot.WelcomeColour)
|
||||
.setTitle(supportbot.WelcomeTitle)
|
||||
.setDescription(supportbot.WelcomeMessage.replace(/%joined_user%/g, member.user))
|
||||
.setTimestamp();
|
||||
|
||||
if (supportbot.EmbedWelcomeThumbnail === "BOT") {
|
||||
WelcomeEmbed.setThumbnail(client.user.displayAvatarURL())
|
||||
}
|
||||
|
||||
if (supportbot.EmbedWelcomeThumbnail === "USER") {
|
||||
WelcomeEmbed.setThumbnail(member.user.displayAvatarURL())
|
||||
}
|
||||
|
||||
if (supportbot.EmbedWelcomeImage) {
|
||||
WelcomeEmbed.setImage(supportbot.EmbedWelcomeImageURL)
|
||||
}
|
||||
|
||||
WelcomeChannel.send({
|
||||
embeds: [WelcomeEmbed]
|
||||
})
|
||||
|
||||
if (supportbot.AutoRole) {
|
||||
var role = member.guild.roles.cache.find(role => role.name === supportbot.JoinRole);
|
||||
member.roles.add(role);
|
||||
}
|
||||
|
||||
console.log(`\u001b[32m`, `[+]`, `\u001b[33m`, `${member.user.username} joined the server!`)
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
@@ -0,0 +1,41 @@
|
||||
|
||||
const Discord = require('discord.js');
|
||||
const fs = require("fs");
|
||||
const Event = require("../Structures/Event.js");
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(
|
||||
fs.readFileSync("./Configs/supportbot.yml", "utf8")
|
||||
);
|
||||
|
||||
module.exports = new Event("guildMemberRemove", async (client, member, interaction, guild) => {
|
||||
|
||||
if (supportbot.Leave) {
|
||||
const LeaveChannel = member.guild.channels.cache.find(channel => channel.name === supportbot.LeaveChannel)
|
||||
|
||||
const LeaveEmbed = new Discord.MessageEmbed()
|
||||
.setColor(supportbot.LeaveColour)
|
||||
.setTitle(supportbot.LeaveTitle)
|
||||
.setDescription(supportbot.LeaveMessage.replace(/%joined_user%/g, member.user))
|
||||
.setTimestamp();
|
||||
|
||||
if (supportbot.EmbedLeaveThumbnail === "BOT") {
|
||||
LeaveEmbed.setThumbnail(client.user.displayAvatarURL())
|
||||
}
|
||||
|
||||
if (supportbot.EmbedLeaveThumbnail === "USER") {
|
||||
LeaveEmbed.setThumbnail(member.user.displayAvatarURL())
|
||||
}
|
||||
|
||||
if (supportbot.EmbedLeaveImage) {
|
||||
LeaveEmbed.setImage(supportbot.EmbedLeaveImageURL)
|
||||
}
|
||||
|
||||
LeaveChannel.send({
|
||||
embeds: [LeaveEmbed]
|
||||
})
|
||||
|
||||
console.log(`\u001b[31m`, `[-]`, `\u001b[33m`, `${member.user.username} joined the server!`)
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
// SupportBot | Emerald Services
|
||||
// Interaction Create Event
|
||||
|
||||
const fs = require("fs");
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(
|
||||
fs.readFileSync("./Configs/supportbot.yml", "utf8")
|
||||
);
|
||||
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
|
||||
|
||||
const Event = require("../Structures/Event.js");
|
||||
|
||||
module.exports = new Event("interactionCreate", async (client, interaction) => {
|
||||
if (interaction.isCommand()) {
|
||||
const command = client.commands.find(
|
||||
(cmd) => cmd.name.toLowerCase() === interaction.commandName
|
||||
);
|
||||
|
||||
if (interaction.user.bot || !interaction.guild) return;
|
||||
|
||||
const NotValid = new Discord.MessageEmbed()
|
||||
.setDescription(`:x: \`Invalid Command\` `)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
|
||||
if (!command)
|
||||
return interaction.reply({
|
||||
embeds: [NotValid],
|
||||
});
|
||||
|
||||
const permission = interaction.member.permissions.has(command.permissions);
|
||||
|
||||
const ValidPerms = new Discord.MessageEmbed()
|
||||
.setDescription(
|
||||
":x: `Invalid Permissions` Do you have the correct permissions to execute this command?"
|
||||
)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
|
||||
if (!permission)
|
||||
return interaction.reply({
|
||||
embeds: [ValidPerms],
|
||||
});
|
||||
command.run(interaction);
|
||||
}
|
||||
if (interaction.isButton()) {
|
||||
if (
|
||||
interaction.customId === "openticket" ||
|
||||
interaction.customId.includes("department-")
|
||||
) {
|
||||
try {
|
||||
const cmd = client.commands.get(cmdconfig.OpenTicket);
|
||||
if (!cmd) return;
|
||||
cmd.run(interaction);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
if (interaction.customId === "ticketclose") {
|
||||
try {
|
||||
const cmd = client.commands.get(cmdconfig.CloseTicket);
|
||||
if (!cmd) return;
|
||||
cmd.run(interaction);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
if (interaction.customId === "ticketlock") {
|
||||
if (interaction.channel.name.startsWith(supportbot.TicketPrefix)) {
|
||||
interaction.message.fetch();
|
||||
let Admin =
|
||||
interaction.guild.roles.cache.find(
|
||||
(AdminUser) => AdminUser.name === supportbot.Admin
|
||||
) ||
|
||||
interaction.guild.roles.cache.find(
|
||||
(AdminUser) => AdminUser.id === supportbot.Admin
|
||||
);
|
||||
if (!interaction.member.roles.cache.has(Admin.id)) {
|
||||
return await interaction.reply({
|
||||
content: "You don't have permission to do that.",
|
||||
ephemeral: true,
|
||||
});
|
||||
}
|
||||
let all = interaction.channel.permissionOverwrites.cache;
|
||||
|
||||
let parent =
|
||||
interaction.guild.channels.cache.find(
|
||||
(c) => c.name === supportbot.LockTicketCategory
|
||||
) ||
|
||||
interaction.guild.channels.cache.find(
|
||||
(c) => c.id === supportbot.LockTicketCategory
|
||||
);
|
||||
if (parent) {
|
||||
await interaction.channel.setParent(parent.id);
|
||||
}
|
||||
|
||||
all.forEach((perm) => {
|
||||
interaction.channel.permissionOverwrites.delete(perm.id);
|
||||
});
|
||||
await interaction.channel.permissionOverwrites.create(Admin.id, {
|
||||
VIEW_CHANNEL: true,
|
||||
});
|
||||
|
||||
await interaction.channel.permissionOverwrites.create(
|
||||
interaction.guild.id,
|
||||
{
|
||||
VIEW_CHANNEL: false,
|
||||
}
|
||||
);
|
||||
|
||||
const ticketDeleteButton = new Discord.MessageButton()
|
||||
.setCustomId("ticketclose")
|
||||
.setLabel("Close")
|
||||
.setStyle(supportbot.TicketDeleteColour)
|
||||
.setEmoji(supportbot.TicketDeleteEmoji);
|
||||
|
||||
const row = new Discord.MessageActionRow().addComponents(
|
||||
ticketDeleteButton
|
||||
);
|
||||
const ArchiveEmbed = new Discord.MessageEmbed()
|
||||
.setTitle("Archived")
|
||||
.setDescription(`Archived ${interaction.channel.name}`)
|
||||
.setColor(supportbot.SuccessColour);
|
||||
|
||||
interaction.reply({ embeds: [ArchiveEmbed] });
|
||||
interaction.message.edit({ components: [row] });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
+217
@@ -0,0 +1,217 @@
|
||||
// SupportBot | Emerald Services
|
||||
// Ready Event
|
||||
|
||||
const fs = require("fs");
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(
|
||||
fs.readFileSync("./Configs/supportbot.yml", "utf8")
|
||||
);
|
||||
const panelconfig = yaml.load(
|
||||
fs.readFileSync("./Configs/ticket-panel.yml", "utf8")
|
||||
);
|
||||
|
||||
const Event = require("../Structures/Event.js");
|
||||
|
||||
module.exports = new Event("ready", async (client, interaction) => {
|
||||
const { getRole, getChannel, getCategory } = client;
|
||||
client.user.setActivity(supportbot.BotActivity, {
|
||||
type: supportbot.ActivityType,
|
||||
url: supportbot.StreamingURL,
|
||||
});
|
||||
|
||||
console.log(`\u001b[107m`, `――――――――――――――――――――――――――――――――――――――――――――`);
|
||||
console.log(`\u001b[91m`, `┏━━━┓╋╋╋╋╋╋╋╋╋╋╋╋╋┏┓┏━━┓╋╋╋┏┓`);
|
||||
console.log(`\u001b[91m`, `┃┏━┓┃╋╋╋╋╋╋╋╋╋╋╋╋┏┛┗┫┏┓┃╋╋┏┛┗┓`);
|
||||
console.log(`\u001b[91m`, `┃┗━━┳┓┏┳━━┳━━┳━━┳┻┓┏┫┗┛┗┳━┻┓┏┛`);
|
||||
console.log(`\u001b[91m`, `┗━━┓┃┃┃┃┏┓┃┏┓┃┏┓┃┏┫┃┃┏━┓┃┏┓┃┃`);
|
||||
console.log(`\u001b[91m`, `┃┗━┛┃┗┛┃┗┛┃┗┛┃┗┛┃┃┃┗┫┗━┛┃┗┛┃┗┓`);
|
||||
console.log(`\u001b[91m`, `┗━━━┻━━┫┏━┫┏━┻━━┻┛┗━┻━━━┻━━┻━┛`);
|
||||
console.log(`\u001b[91m`, `┗╋╋╋╋╋╋╋┃┃╋┃┃`);
|
||||
console.log(`\u001b[91m`, `╋╋╋╋╋╋╋┗┛╋┗┛`);
|
||||
console.log(` `);
|
||||
console.log(`\u001b[32m`, `――――――――――――――――――――――――――――――――――――――――――――`);
|
||||
console.log(` `);
|
||||
console.log(
|
||||
`\u001b[33m`,
|
||||
`${supportbot.Name} | v${supportbot.SupportBot_Version}`,
|
||||
`\u001b[36m`,
|
||||
`Connected to Discord`
|
||||
);
|
||||
console.log(
|
||||
`\u001b[33m`,
|
||||
`Invite to your server:`,
|
||||
`\u001b[36m`,
|
||||
`https://discord.com/api/oauth2/authorize?client_id=` +
|
||||
client.user.id +
|
||||
`&permissions=8&scope=bot%20applications.commands`
|
||||
);
|
||||
console.log(
|
||||
`\u001b[33m`,
|
||||
`Resources:`,
|
||||
`\u001b[36m`,
|
||||
`https://emeraldsrv.dev/resources`
|
||||
);
|
||||
console.log(
|
||||
`\u001b[33m`,
|
||||
`Documentation:`,
|
||||
`\u001b[36m`,
|
||||
`https://emeraldsrv.dev/wiki/supportbot`
|
||||
);
|
||||
console.log(
|
||||
`\u001b[33m`,
|
||||
`Discord:`,
|
||||
`\u001b[36m`,
|
||||
`https://emeraldsrv.dev/discord`
|
||||
);
|
||||
console.log(
|
||||
`\u001b[33m`,
|
||||
`Hosting:`,
|
||||
`\u001b[36m`,
|
||||
`https://emeraldsrv.dev/hosting`
|
||||
);
|
||||
console.log(` `);
|
||||
console.log(`\u001b[37m`, `SupportBot proudly created by Emerald Services`);
|
||||
console.log(` `);
|
||||
console.log(`\u001b[31m`, `――――――――――――――――――――――――――――――――――――――――――――`);
|
||||
|
||||
|
||||
|
||||
|
||||
const roles = [
|
||||
supportbot.Admin,
|
||||
supportbot.Staff,
|
||||
supportbot.TicketBlackListRole,
|
||||
];
|
||||
|
||||
supportbot.Departments.forEach((department) => roles.push(department.role));
|
||||
|
||||
if (supportbot.AutoRole) roles.push(supportbot.JoinRole);
|
||||
const channels = [
|
||||
supportbot.SuggestionChannel,
|
||||
supportbot.TicketLog,
|
||||
supportbot.TranscriptLog,
|
||||
panelconfig.Channel,
|
||||
supportbot.WelcomeChannel,
|
||||
supportbot.LeaveChannel,
|
||||
supportbot.TranslateLogChannel
|
||||
];
|
||||
//const categories = [supportbot.TicketCategory];
|
||||
|
||||
const missingC = [];
|
||||
const missingR = [];
|
||||
const missingCat = [];
|
||||
for (let c of channels) {
|
||||
if ((c === supportbot.SuggestionChannel && supportbot.DisableSuggestionsChannel) || c === supportbot.TicketLog && supportbot.DisableTicketLogChannel) {
|
||||
continue;
|
||||
}
|
||||
const find = await getChannel(c, client.guilds.cache.first());
|
||||
if (!find) missingC.push(c);
|
||||
}
|
||||
for (let r of roles) {
|
||||
const find = await getRole(r, client.guilds.cache.first());
|
||||
if (!find) missingR.push(r);
|
||||
}
|
||||
// for (let cat of categories) {
|
||||
// const find = await getCategory(cat, client.guilds.cache.first());
|
||||
// if (!find) missingCat.push(cat);
|
||||
// }
|
||||
|
||||
if (missingR.length > 0) {
|
||||
console.log(
|
||||
"\u001b[33m",
|
||||
`[WARN] The following Roles could not be found! Please check your configs!\n${missingR.join(
|
||||
", "
|
||||
)}`
|
||||
);
|
||||
}
|
||||
|
||||
if (missingC.length > 0) {
|
||||
console.log(
|
||||
"\u001b[33m",
|
||||
`[WARN] The following Channels could not be found! Please check your configs!\n${missingC.join(
|
||||
", "
|
||||
)}`
|
||||
);
|
||||
}
|
||||
if (missingCat.length > 0) {
|
||||
console.log(
|
||||
"\u001b[33m",
|
||||
`[WARN] The following Categories could not be found! Please check your configs!\n${missingCat.join(
|
||||
", "
|
||||
)}`
|
||||
);
|
||||
}
|
||||
if (panelconfig.TicketPanel) {
|
||||
let chan1 = await client.getChannel(
|
||||
panelconfig.Channel,
|
||||
client.guilds.cache.first()
|
||||
);
|
||||
|
||||
if (!chan1) {
|
||||
console.log(
|
||||
"\u001b[33m",
|
||||
"[WARN] Ticket reaction panel is not setup, You can do so via the configuration file!"
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
const panelid = JSON.parse(
|
||||
fs.readFileSync("./Data/ticket-panel-id.json", "utf8")
|
||||
);
|
||||
|
||||
chan1.messages.fetch(panelid.TicketPanelID).catch(async () => {
|
||||
let embed = new Discord.MessageEmbed()
|
||||
.setTitle(panelconfig.PanelTitle)
|
||||
.setColor(panelconfig.PanelColour)
|
||||
.setFooter({
|
||||
text: supportbot.EmbedFooter,
|
||||
iconURL: interaction.user.displayAvatarURL(),
|
||||
});
|
||||
|
||||
if (panelconfig.TicketPanel_Description) {
|
||||
embed.setDescription(panelconfig.PanelMessage);
|
||||
}
|
||||
|
||||
if (panelconfig.TicketPanel_Thumbnail) {
|
||||
embed.setThumbnail(panelconfig.PanelThumbnail);
|
||||
}
|
||||
|
||||
if (panelconfig.TicketPanel_Image) {
|
||||
embed.setImage(panelconfig.PanelImage);
|
||||
}
|
||||
let button;
|
||||
|
||||
button = supportbot.Departments.map((x) =>
|
||||
new Discord.MessageButton()
|
||||
.setCustomId("department-" + supportbot.Departments.indexOf(x))
|
||||
.setLabel(x.title)
|
||||
.setStyle(x.color)
|
||||
.setEmoji(x.emoji)
|
||||
);
|
||||
|
||||
let row = new Discord.MessageActionRow().addComponents(button);
|
||||
|
||||
await chan1
|
||||
.send({
|
||||
embeds: [embed],
|
||||
components: [row],
|
||||
})
|
||||
.then((r) => {
|
||||
let data = {
|
||||
id: panelid.id,
|
||||
TicketPanelID: r.id,
|
||||
};
|
||||
fs.writeFileSync(
|
||||
"./Data/ticket-panel-id.json",
|
||||
JSON.stringify(data),
|
||||
"utf8"
|
||||
);
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log("Raw: " + e);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 Emerald Services
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017 Toru Nagashima
|
||||
Copyright (c) 2022 Emerald Services
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -1,13 +1,75 @@
|
||||

|
||||
|
||||
## What is SupportBot?
|
||||
|
||||
SupportBot is an open-sourced support system for discord. It's completely free to use with high amounts of customisation to match your own brand.
|
||||
|
||||
## Quick Links
|
||||
|
||||
**|** [Discord](https://emeraldsrv.dev/discord) **|**
|
||||
[Hosting](https://emeraldsrv.dev/hosting) **|**
|
||||
[Documentation](https://docs.emeraldsrv.dev) **|**
|
||||
[Download via Polymart](https://polymart.org/resource/supportbot-1-discord-ticket-bot.518) **|**
|
||||
[Download via MC-Market](https://www.mc-market.org/resources/8940/) **|**
|
||||
<h1 align="center">
|
||||
<br>
|
||||
<a href="https://github.com/Emerald-Services/SupportBot"><img src="https://i.imgur.com/tzi3d7Q.png"></a>
|
||||
<br>
|
||||
SupportBot
|
||||
<br>
|
||||
</h1>
|
||||
|
||||
<div align="center">
|
||||
|
||||
<a href="https://opensource.org/licenses/MIT">
|
||||
<img src="https://img.shields.io/badge/license-MIT-green?style=for-the-badge" alt="shield.png">
|
||||
</a>
|
||||
|
||||
<a href="https://github.com/discordjs">
|
||||
<img src="https://img.shields.io/badge/discord.js-v13.6.x-blue.svg?style=for-the-badge&logo=javascript.svg" alt="shield.png">
|
||||
</a>
|
||||
|
||||
<a href="https://github.com/nodejs/node">
|
||||
<img src="https://img.shields.io/badge/node.js-v16.14.x-green.svg?style=for-the-badge&logo=node" alt="shield.png">
|
||||
</a>
|
||||
|
||||
<a href="https://github.com/Emerald-Services/SupportBot/releases">
|
||||
<img src="https://img.shields.io/github/downloads/Emerald-Services/SupportBot/total?style=for-the-badge" alt="shield.png">
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://emeraldsrv.dev/">Website</a>
|
||||
•
|
||||
<a href="https://github.com/Emerald-Services/SupportBot/wiki">Wiki</a>
|
||||
<br>
|
||||
<a href="#about">About</a>
|
||||
•
|
||||
<a href="#support">Support</a>
|
||||
•
|
||||
<a href="#license">License</a>
|
||||
•
|
||||
<a href="https://github.com/Emerald-Services/SupportBot/wiki/Third-Party-Developer">Third-Party</a>
|
||||
•
|
||||
<a href="#contributors">Contributors</a>
|
||||
</p>
|
||||
|
||||
## About
|
||||
|
||||
SupportBot is an Open-Source discord bot built with [discord.js](https://github.com/discordjs/discord.js). It's primarily focused to help servers organise and manage their support system in a unique way with full customisation to match your brand.
|
||||
|
||||
## Support
|
||||
|
||||
<a href="https://emeraldsrv.dev/discord">
|
||||
<img alt="Discord" src="https://img.shields.io/discord/597779408295821323?logo=discord&logoColor=white&style=for-the-badge">
|
||||
</a>
|
||||
|
||||
|
||||
## License
|
||||
|
||||
Released under the [MIT](https://opensource.org/licenses/MIT) license.
|
||||
|
||||
|
||||
## Third-Party
|
||||
|
||||
- [Syphers Addons](https://github.com/SypherRed/SB_Addons_Unofficial)
|
||||
- [BuiltByBit](https://builtbybit.com/supportbot)
|
||||
- [Polymart](https://polymart.org/resource/supportbot-1-discord-ticket-bot.518)
|
||||
|
||||
|
||||
## Contributors
|
||||
|
||||
<a href="https://github.com/Emerald-Services/SupportBot/graphs/contributors">
|
||||
<img src="https://contrib.rocks/image?repo=Emerald-Services/SupportBot">
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
// SupportBot | Emerald Services
|
||||
// Addon Structure
|
||||
|
||||
class Command {
|
||||
constructor(options) {
|
||||
this.name = options.name;
|
||||
this.description = options.description;
|
||||
this.permissions = options.permissions;
|
||||
this.options = options.options || [];
|
||||
this.run = options.run;
|
||||
this.defaultPermission = true;
|
||||
}
|
||||
}
|
||||
class Event {
|
||||
constructor(event, run) {
|
||||
this.event = event;
|
||||
this.run = run;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { Command, Event };
|
||||
@@ -0,0 +1,126 @@
|
||||
// SupportBot | Emerald Services
|
||||
// Client Structure
|
||||
|
||||
const fs = require("fs");
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const intents = new Discord.Intents(32767);
|
||||
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(
|
||||
fs.readFileSync("./Configs/supportbot.yml", "utf8")
|
||||
);
|
||||
|
||||
class Client extends Discord.Client {
|
||||
constructor() {
|
||||
super({ intents });
|
||||
|
||||
this.commands = new Discord.Collection();
|
||||
}
|
||||
async getChannel(channel, guild) {
|
||||
return guild.channels.cache.find(
|
||||
(c) =>
|
||||
(c.type === "GUILD_TEXT" || c.type === "GUILD_NEWS") &&
|
||||
(c.id === channel || c.name.toLowerCase() === channel.toLowerCase())
|
||||
);
|
||||
}
|
||||
async getRole(role, guild) {
|
||||
return guild.roles.cache.find(
|
||||
(r) => r.id === role || r.name.toLowerCase() === role.toLowerCase()
|
||||
);
|
||||
}
|
||||
async getCategory(category, guild) {
|
||||
return guild.channels.cache.find(
|
||||
(c) =>
|
||||
c.type === "GUILD_CATEGORY" &&
|
||||
(c.id === category || c.name.toLowerCase() === category.toLowerCase())
|
||||
);
|
||||
}
|
||||
|
||||
async start(token) {
|
||||
var tempCommandFiles = fs.readdirSync("./Commands").filter((file) => file.endsWith(".js"));
|
||||
|
||||
if (supportbot.DisableSuggestions) {
|
||||
tempCommandFiles = tempCommandFiles.filter(item => item !== "suggest.js");
|
||||
}
|
||||
|
||||
const commandFiles = tempCommandFiles;
|
||||
|
||||
const addonFiles = fs
|
||||
.readdirSync("./Addons")
|
||||
.filter((file) => file.endsWith(".js"));
|
||||
|
||||
const addons = addonFiles.map((file) => {
|
||||
let addon = require(`../Addons/${file}`);
|
||||
addon.name = file.split(".")[0];
|
||||
return addon;
|
||||
});
|
||||
|
||||
const commands = commandFiles.map((file) => require(`../Commands/${file}`));
|
||||
|
||||
// Commands
|
||||
console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Commands ▬▬▬▬▬▬▬");
|
||||
|
||||
commands.forEach((cmd) => {
|
||||
console.log(`\u001b[31;1m`, `${cmd.name}`, `\u001b[32;1m`, "Loaded");
|
||||
this.commands.set(cmd.name, cmd);
|
||||
});
|
||||
|
||||
console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Commands ▬▬▬▬▬▬▬");
|
||||
// Addons
|
||||
console.log(" ");
|
||||
console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Addons ▬▬▬▬▬▬▬");
|
||||
|
||||
addons.forEach((addon) => {
|
||||
console.log(
|
||||
`\u001b[33m`,
|
||||
`[ADDON]`,
|
||||
`\u001b[31;1m`,
|
||||
`${addon.name}`,
|
||||
`\u001b[32;1m`,
|
||||
"Loaded"
|
||||
);
|
||||
addon.commands?.forEach((command) => {
|
||||
this.commands.set(command.name, command);
|
||||
});
|
||||
addon.events?.forEach((event) => {
|
||||
this.on(event.event, (...args) => event.run(this, ...args));
|
||||
});
|
||||
});
|
||||
|
||||
console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Addons ▬▬▬▬▬▬▬");
|
||||
|
||||
// Slash Commands
|
||||
|
||||
this.once("ready", async () => {
|
||||
await this.guilds.cache.first()?.commands.set(this.commands);
|
||||
console.log(
|
||||
`\u001b[32;1m`,
|
||||
`Slash Commands Registered for ${this.guilds.cache.first().name}`
|
||||
);
|
||||
});
|
||||
|
||||
console.log(" ");
|
||||
console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Events ▬▬▬▬▬▬▬");
|
||||
|
||||
fs.readdirSync("./Events")
|
||||
.filter((file) => file.endsWith(".js"))
|
||||
.forEach((file) => {
|
||||
const event = require(`../Events/${file}`);
|
||||
console.log(`\u001b[31;1m`, `${event.event}`, `\u001b[32;1m`, "Loaded");
|
||||
this.on(event.event, (...args) => event.run(this, ...args));
|
||||
});
|
||||
|
||||
console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Events ▬▬▬▬▬▬▬");
|
||||
if (process.argv[2] !== "test") {
|
||||
await this.login(token);
|
||||
} else {
|
||||
console.log(
|
||||
`\u001b[31;1m`,
|
||||
"RUNNING IN TEST MODE, IF NOT INTENDED, PLEASE USE npm start"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Client;
|
||||
@@ -0,0 +1,14 @@
|
||||
// SupportBot | Emerald Services
|
||||
// Command Structure
|
||||
|
||||
class Command {
|
||||
constructor(options) {
|
||||
this.name = options.name;
|
||||
this.description = options.description;
|
||||
this.permissions = options.permissions || [];
|
||||
this.options = options.options || [];
|
||||
this.run = options.run;
|
||||
this.defaultPermission = true;
|
||||
}
|
||||
}
|
||||
module.exports = Command;
|
||||
@@ -0,0 +1,10 @@
|
||||
// SupportBot | Emerald Services
|
||||
// Event Structure
|
||||
class Event {
|
||||
constructor(event, run) {
|
||||
this.event = event;
|
||||
this.run = run;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Event;
|
||||
@@ -0,0 +1,47 @@
|
||||
// SupportBot | Emerald Services
|
||||
// Ticket ID Structure
|
||||
|
||||
const fs = require("fs");
|
||||
|
||||
class TicketNumberID {
|
||||
static async pad() {
|
||||
let num = await this.get();
|
||||
let n = num + "";
|
||||
await this.set(num + 1);
|
||||
return n.length >= 4 ? n : new Array(4 - n.length + 1).join("0") + n;
|
||||
}
|
||||
|
||||
static async get() {
|
||||
let ticketnumberID = await JSON.parse(
|
||||
fs.readFileSync("./Data/ticket-panel-id.json", "utf8")
|
||||
);
|
||||
if (!ticketnumberID.id) {
|
||||
return this.set(0);
|
||||
} else {
|
||||
return ticketnumberID.id;
|
||||
}
|
||||
}
|
||||
|
||||
static async set(value) {
|
||||
let ticketnumberID = await JSON.parse(
|
||||
fs.readFileSync("./Data/ticket-panel-id.json", "utf8")
|
||||
);
|
||||
|
||||
ticketnumberID.id = value;
|
||||
fs.writeFileSync(
|
||||
"./Data/ticket-panel-id.json",
|
||||
JSON.stringify(ticketnumberID, null, 4),
|
||||
(err) => {
|
||||
if (err) console.error(err);
|
||||
}
|
||||
);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
static async reset() {
|
||||
return await this.set(0);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = TicketNumberID;
|
||||
@@ -1,20 +0,0 @@
|
||||
// SupportBot, Created by Emerald Services
|
||||
// Help Command
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
|
||||
// location for the addons configuration, to keep it simple we generate a settings folder within the addons directory.
|
||||
const example = yaml.load(fs.readFileSync('./addons/settings/exampleaddon.yml', 'utf8'));
|
||||
|
||||
module.exports = {
|
||||
name: example.ExampleAddonCommand,
|
||||
description: example.ExampleAddonDesc,
|
||||
|
||||
execute(message, args) {
|
||||
if (supportbot.DeleteMessages == "true") message.delete();
|
||||
message.channel.send(example.ExampleAddonMessage)
|
||||
}
|
||||
};
|
||||
@@ -1,9 +0,0 @@
|
||||
#
|
||||
# SupportBot, Created by Emerald Services
|
||||
# Example Addon
|
||||
#
|
||||
|
||||
ExampleAddonCommand: "exampleaddon"
|
||||
ExampleAddonDesc: "This is the default/example addon for SupportBot."
|
||||
|
||||
ExampleAddonMessage: "> :white_check_mark: This is the **default** addon for SupportBot. You can download addons from our website, https://emeraldservices.xyz/"
|
||||
@@ -1,64 +0,0 @@
|
||||
// SupportBot, Created by Emerald Services
|
||||
// Add User
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = {
|
||||
name: supportbot.AddUser,
|
||||
description: supportbot.AddUserDesc,
|
||||
|
||||
execute(message, args) {
|
||||
if (supportbot.DeleteMessages) message.delete();
|
||||
|
||||
let SupportStaff = message.guild.roles.cache.find(SupportTeam => SupportTeam.name === supportbot.Staff) || message.guild.roles.cache.find(SupportTeam => SupportTeam.id === supportbot.Staff)
|
||||
let Admins = message.guild.roles.cache.find(AdminUser => AdminUser.name === supportbot.Admin) || message.guild.roles.cache.find(AdminUser => AdminUser.id === supportbot.Admin)
|
||||
|
||||
const NoPerms = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Permissions!")
|
||||
.setDescription(`${supportbot.IncorrectPerms}\n\nRole Required: \`${supportbot.Staff}\` or \`${supportbot.Admin}\``)
|
||||
.setColor(supportbot.WarningColour)
|
||||
|
||||
if (message.member.roles.cache.has(SupportStaff.id) || message.member.roles.cache.has(Admins.id)) {
|
||||
if (!message.channel.name.startsWith( `${supportbot.TicketChannel}-` )) {
|
||||
const Exists = new Discord.MessageEmbed()
|
||||
.setTitle("No Ticket Found!")
|
||||
.setDescription(`${supportbot.NoValidTicket}`)
|
||||
.setColor(supportbot.WarningColour);
|
||||
message.channel.send({ embeds: [Exists] });
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
let rUser = message.guild.member(message.mentions.users.first() || message.guild.members.cache.get(args[0]));
|
||||
const UserNotExist = new Discord.MessageEmbed()
|
||||
.setTitle("User Not Found!")
|
||||
.setDescription(`${supportbot.UserNotFound}\n\nTry Again:\`${supportbot.Prefix}${supportbot.AddUser} <user#0000>\``)
|
||||
.setColor(supportbot.ErrorColour)
|
||||
|
||||
if (!rUser) return message.channel.send({ embeds: [UserNotExist] });
|
||||
|
||||
message.channel.updateOverwrite(rUser, {
|
||||
VIEW_CHANNEL: true,
|
||||
CREATE_INVITE: false,
|
||||
SEND_MESSAGES: true,
|
||||
READ_MESSAGES: true
|
||||
});
|
||||
|
||||
const Complete = new Discord.MessageEmbed()
|
||||
.setTitle("User Added!")
|
||||
.setDescription(supportbot.AddedUser.replace(/%user%/g, rUser.id))
|
||||
.setTimestamp()
|
||||
.setColor(supportbot.EmbedColour)
|
||||
message.channel.send({ embeds: [Complete] });
|
||||
} else {
|
||||
|
||||
return message.channel.send({ embeds: [NoPerms] });
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
@@ -1,71 +0,0 @@
|
||||
// SupportBot, Created by Emerald Services
|
||||
// Announce
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const { execute } = require("./help");
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = {
|
||||
name: supportbot.AnnounceCommand,
|
||||
description: supportbot.AnnounceDesc,
|
||||
|
||||
execute(message, args) {
|
||||
|
||||
if (supportbot.DeleteMessages) message.delete();
|
||||
|
||||
let locateChannel = message.guild.channels.cache.find(AnnouncementChannel => AnnouncementChannel.name === supportbot.AnnouncementChannel) || message.guild.channels.cache.find(AnnouncementChannel => AnnouncementChannel.id === supportbot.AnnouncementChannel)
|
||||
|
||||
const errornochannel = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Channel")
|
||||
.setDescription(`${supportbot.InvalidChannel}\n\nChannel Required: \`${supportbot.AnnouncementChannel}`)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
|
||||
if(!locateChannel) return message.channel.send({ embeds: [errornochannel] });
|
||||
|
||||
let Admins = message.guild.roles.cache.find(adminRole => adminRole.name === supportbot.Admin) || message.guild.roles.cache.find(adminRole => adminRole.id === supportbot.Admin)
|
||||
|
||||
const NoPerms = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Permissions!")
|
||||
.setDescription(`${supportbot.IncorrectPerms}\n\nRole Required: \`${Admins.name}\``)
|
||||
.setColor(supportbot.WarningColour)
|
||||
|
||||
if (!message.member.roles.cache.has(Admins.id))
|
||||
return message.channel.send({ embeds: [NoPerms] });
|
||||
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setDescription(`> **${supportbot.AnnouncementStarter}**`)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
message.channel.send({ embeds: [embed] });
|
||||
|
||||
let announcement = []
|
||||
message.channel.awaitMessages(response => response.content.length > 2, {
|
||||
max: 1,
|
||||
time: 500000,
|
||||
errors: ['time'],
|
||||
}).then((collected) => {
|
||||
announcement.push(collected.map(r => r.content));
|
||||
|
||||
locateChannel.send('@everyone')
|
||||
const AnnouncementEmbed = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.AnnouncementTitle)
|
||||
.setThumbnail(supportbot.AnnouncementIcon)
|
||||
.setDescription(announcement)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter(supportbot.EmbedFooter, message.author.displayAvatarURL());
|
||||
|
||||
locateChannel.send({ embed: AnnouncementEmbed }).then(async function(msg) {
|
||||
const AnnouncementComplete = new Discord.MessageEmbed()
|
||||
.setColor(supportbot.SuccessColour)
|
||||
.setDescription(`:white_check_mark: You have successfully created an announcement. <#${locateChannel.id}>`)
|
||||
message.channel.send({ embeds: [AnnouncementComplete] })
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
-108
@@ -1,108 +0,0 @@
|
||||
// SupportBot, Created by Emerald Services
|
||||
// Say Command
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const { execute } = require("./help");
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = {
|
||||
name: supportbot.BanUser,
|
||||
description: supportbot.BanDesc,
|
||||
|
||||
execute(message, args, member) {
|
||||
if (supportbot.DeleteMessages) message.delete();
|
||||
|
||||
let SupportStaff = message.guild.roles.cache.find(adminRole => adminRole.name === supportbot.Admin) || message.guild.roles.cache.find(adminRole => adminRole.id === supportbot.Admin)
|
||||
|
||||
const NoPerms = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Permissions!")
|
||||
.setDescription(`${supportbot.IncorrectPerms}\n\nRole Required: \`${SupportStaff.name}\``)
|
||||
.setColor(supportbot.WarningColour)
|
||||
|
||||
if (!message.member.roles.cache.has(SupportStaff.id))
|
||||
return message.channel.send({ embeds: [NoPerms] });
|
||||
|
||||
let locateChannel = message.guild.channels.cache.find(ModLogChannel => ModLogChannel.name === supportbot.ModLogChannel) || message.guild.channels.cache.find(ModLogChannel => ModLogChannel.id === supportbot.ModLogChannel)
|
||||
|
||||
const errornochannel = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Channel")
|
||||
.setDescription(`${supportbot.InvalidChannel}\n\nChannel Required: \`${supportbot.ModLogChannel}\``)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
|
||||
if(!locateChannel) return message.channel.send({ embeds: [errornochannel] });
|
||||
|
||||
const user = message.mentions.members.first() || message.guild.members.cache.get(args[0]);
|
||||
|
||||
const embed1 = new Discord.MessageEmbed()
|
||||
.setDescription("> :x: Please provide a reason to ban.\n\n`Try Again!`")
|
||||
.setColor(supportbot.ErrorColour)
|
||||
|
||||
if (!args[0]) return message.channel.send({
|
||||
embeds: [embed1]
|
||||
});
|
||||
|
||||
const embed2 = new Discord.MessageEmbed()
|
||||
.setDescription("> :detective: **Hmm!** Can\'t seem tp find this user.\n\n`Are they in the server?`")
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
if (!user) return message.channel.send({
|
||||
embeds: [embed2]
|
||||
})
|
||||
|
||||
const embed3 = new Discord.MessageEmbed()
|
||||
.setDescription("> :x: **Err No!** Cannot punish this user!\n\n`Reason: Their permissions and or roles are greater than mine.`")
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
if(!user.bannable) return message.channel.send({
|
||||
embeds: [embed3]
|
||||
});
|
||||
|
||||
const embed4 = new Discord.MessageEmbed()
|
||||
.setDescription("> :joy: **OML!** Did you really just try to ban yourself!")
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
if(user.id === message.author.id) return message.channel.send({
|
||||
embeds: [embed4]
|
||||
});
|
||||
|
||||
let reason = args.slice(1).join(" ");
|
||||
|
||||
if(!reason) reason = 'No Reason Provided.';
|
||||
|
||||
const embed5 = new Discord.MessageEmbed()
|
||||
.setDescription("> :thinking: **Hmm** Something seems to have gone wrong.\n\n`Check your system for errors!`")
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
user.ban({ days: supportbot.DaysBannedFor, reason: `${reason}` }).catch(err => {
|
||||
message.channel.send({ embeds: [embed5] })
|
||||
console.log(err)
|
||||
})
|
||||
|
||||
|
||||
const successEmbed = new Discord.MessageEmbed()
|
||||
.setDescription(`> :white_check_mark: **OOF!** ${user} has been banned!`)
|
||||
.setColor(supportbot.SuccessColour)
|
||||
message.channel.send({
|
||||
embed: successEmbed
|
||||
})
|
||||
|
||||
const logEmbed = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.BanTitle)
|
||||
.setThumbnail(supportbot.ModThumbnail)
|
||||
.addField('Banned User:', user)
|
||||
.addField('Staff Member', message.author)
|
||||
.addField('Reason:', reason)
|
||||
.setFooter(supportbot.EmbedFooter)
|
||||
.setColor(supportbot.BanLogColour)
|
||||
.setTimestamp()
|
||||
|
||||
locateChannel.send({ embeds: [logEmbed] })
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
@@ -1,100 +0,0 @@
|
||||
// SupportBot, Created by Emerald Services
|
||||
// Blacklist Command
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const { execute } = require("./help");
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = {
|
||||
name: supportbot.BlacklistUser,
|
||||
description: supportbot.BlacklistDesc,
|
||||
|
||||
execute(message, args) {
|
||||
if (supportbot.DeleteMessages) message.delete();
|
||||
|
||||
let SupportStaff = message.guild.roles.cache.find(adminRole => adminRole.name === supportbot.Admin) || message.guild.roles.cache.find(adminRole => adminRole.id === supportbot.Admin)
|
||||
|
||||
const NoPerms = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Permissions!")
|
||||
.setDescription(`${supportbot.IncorrectPerms}\n\nRole Required: \`${SupportStaff.name}\``)
|
||||
.setColor(supportbot.WarningColour)
|
||||
|
||||
if (!message.member.roles.cache.has(SupportStaff.id)) {
|
||||
return message.channel.send({ embeds: [NoPerms] });
|
||||
}
|
||||
|
||||
let locateChannel = message.guild.channels.cache.find(ModLogChannel => ModLogChannel.name === supportbot.ModLogChannel) || message.guild.channels.cache.find(ModLogChannel => ModLogChannel.id === supportbot.ModLogChannel)
|
||||
|
||||
const user = message.mentions.members.first() || message.guild.members.cache.get(args[0]);
|
||||
|
||||
const errornochannel = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Channel")
|
||||
.setDescription(`${supportbot.InvalidChannel}\n\nChannel Required: \`${supportbot.ModLogChannel}\``)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
|
||||
if(!locateChannel) return message.channel.send({ embeds: [errornochannel] });
|
||||
|
||||
const embed1 = new Discord.MessageEmbed()
|
||||
.setDescription("> :x: Please mention or write an ID\n\n`Try Again!`")
|
||||
.setColor(supportbot.ErrorColour)
|
||||
|
||||
if (!args[0]) return message.channel.send({
|
||||
embeds: [embed1]
|
||||
});
|
||||
|
||||
const embed2 = new Discord.MessageEmbed()
|
||||
.setDescription("> :detective: **Hmm!** Can\'t seem tp find this user.\n\n`Are they in the server?`")
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
if (!user) return message.channel.send({
|
||||
embeds: [embed2]
|
||||
});
|
||||
|
||||
let role = message.guild.roles.cache.find(role => role.name === supportbot.TicketBlackListRole) || message.guild.roles.cache.find(role => role.id === supportbot.TicketBlackListRole)
|
||||
|
||||
const embed3 = new Discord.MessageEmbed()
|
||||
.setDescription("> :detective: **Hmm!** Can\'t seem to find the blacklist role.\n\n`Did you created it?")
|
||||
.setColor(supportbot.ErrorColour)
|
||||
|
||||
|
||||
if (!role) return message.channel.send({
|
||||
embeds: [embed3]
|
||||
});
|
||||
|
||||
const embed4 = new Discord.MessageEmbed()
|
||||
.setDescription(`${user} is already blacklisted`)
|
||||
.setColor(supportbot.ErrorColour)
|
||||
|
||||
if(user.roles.cache.find(role => role.name === supportbot.TicketBlackListRole) || user.roles.cache.find(role => role.id === supportbot.TicketBlackListRole)) {
|
||||
return message.channel.send({
|
||||
embeds: [embed4]
|
||||
})
|
||||
};
|
||||
|
||||
user.roles.add(role);
|
||||
|
||||
const embed5 = new Discord.MessageEmbed()
|
||||
.setDescription(`Blacklisted ${user} successfully from creating a ticket`)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
message.channel.send({
|
||||
embeds: [embed5]
|
||||
});
|
||||
|
||||
const logEmbed = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.BlacklistTitle)
|
||||
.setThumbnail(supportbot.ModThumbnail)
|
||||
.addField('Banned User:', user)
|
||||
.addField('Staff Member', message.author)
|
||||
.setFooter(supportbot.EmbedFooter)
|
||||
.setColor(supportbot.BlacklistColour)
|
||||
.setTimestamp()
|
||||
|
||||
locateChannel.send({ embeds: [logEmbed] });
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
@@ -1,51 +0,0 @@
|
||||
// SupportBot, Created by Emerald Services
|
||||
// Say Command
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const { execute } = require("./help");
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = {
|
||||
name: supportbot.BotSay,
|
||||
description: supportbot.BotSayDesc,
|
||||
|
||||
execute(message, args) {
|
||||
if (supportbot.DeleteMessages) message.delete();
|
||||
|
||||
let SupportStaff = message.guild.roles.cache.find(adminRole => adminRole.name === supportbot.Staff) || message.guild.roles.cache.find(adminRole => adminRole.id === supportbot.Staff)
|
||||
|
||||
const NoPerms = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Permissions!")
|
||||
.setDescription(`${supportbot.IncorrectPerms}\n\nRole Required: \`${SupportStaff.name}\``)
|
||||
.setColor(supportbot.WarningColour)
|
||||
|
||||
if (!message.member.roles.cache.has(SupportStaff.id))
|
||||
return message.channel.send({ embeds: [NoPerms] });
|
||||
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setDescription(`> **What would you like me to say!**`)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
message.channel.send({ embeds: [embed] });
|
||||
|
||||
let announcement = []
|
||||
message.channel.awaitMessages(response => response.content.length > 2, {
|
||||
max: 1,
|
||||
time: 500000,
|
||||
errors: ['time'],
|
||||
}).then((collected) => {
|
||||
announcement.push(collected.map(r => r.content));
|
||||
|
||||
const AnnouncementEmbed = new Discord.MessageEmbed()
|
||||
.setDescription(announcement)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
message.channel.send({ embeds: [AnnouncementEmbed] })
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
@@ -1,163 +0,0 @@
|
||||
// SupportBot, Created by Emerald Services
|
||||
// Close Command
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const { execute } = require("./help");
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = {
|
||||
name: supportbot.CloseTicket,
|
||||
description: supportbot.CloseTicketDesc,
|
||||
|
||||
execute(message, args) {
|
||||
if (supportbot.DeleteMessages) message.delete();
|
||||
|
||||
if (!message.channel.name.startsWith( `${supportbot.TicketChannel}-` )) {
|
||||
const Exists = new Discord.MessageEmbed()
|
||||
.setTitle("No Ticket Found!")
|
||||
.setDescription(`${supportbot.NoValidTicket}`)
|
||||
.setColor(supportbot.WarningColour);
|
||||
message.channel.send({ embed: Exists });
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (supportbot.CloseConfirmation) {
|
||||
const CloseTicketRequest = new Discord.MessageEmbed()
|
||||
.setTitle(`**${supportbot.ClosingTicket}**`)
|
||||
.setDescription(`Please confirm by repeating the following word.. \`${supportbot.ClosingConfirmation_Word}\` `)
|
||||
.setColor(supportbot.EmbedColour);
|
||||
|
||||
message.channel.send(CloseTicketRequest).then(m => {
|
||||
message.channel.awaitMessages( response => response.content.toLowerCase() === supportbot.ClosingConfirmation_Word, {
|
||||
max: 1,
|
||||
time: 20000,
|
||||
errors: [ 'time' ],
|
||||
|
||||
|
||||
}).then( collected => {
|
||||
let logChannel = message.guild.channels.cache.find(channel => channel.name === supportbot.TranscriptLog) || message.guild.channels.cache.find(channel => channel.id === supportbot.TranscriptLog)
|
||||
let user = message.author;
|
||||
let reason = args.join(" ") || "No Reason Provided.";
|
||||
|
||||
let name = message.channel.name;
|
||||
let ticketChannel = message.channel;
|
||||
|
||||
message.channel.send(`**${supportbot.ClosingTicket}**`)
|
||||
|
||||
.then(() => {
|
||||
const logEmbed = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.TranscriptTitle)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter(supportbot.EmbedFooter)
|
||||
.addField("Closed By", message.author.tag)
|
||||
.addField("Reason", reason);
|
||||
|
||||
message.channel.messages.fetch({ limit: 100 }).then( msgs => {
|
||||
let html = '';
|
||||
|
||||
msgs = msgs.sort( ( a, b ) => a.createdTimestamp - b.createdTimestamp );
|
||||
html += `<strong>Server Name:</strong> ${message.guild.name}<br>`;
|
||||
html += `<strong>Ticket:</strong> ${ticketChannel.name}<br>`;
|
||||
html += `<strong>Message:</strong> ${msgs.size} Messages<br><br><br>`;
|
||||
|
||||
msgs.forEach( msg => {
|
||||
if ( msg.content ) {
|
||||
html += `<strong>User:</strong> ${msg.author.tag}<br>`;
|
||||
html += `<strong>Message:</strong> ${msg.content}<br>`;
|
||||
html += `-----<br><br>`;
|
||||
}
|
||||
});
|
||||
|
||||
logChannel.send({embeds: [logEmbed]}).catch(err => {
|
||||
message.reply(err)
|
||||
})
|
||||
|
||||
|
||||
let file = new Discord.MessageAttachment( Buffer.from( html ), `${name}.html` )
|
||||
logChannel.send({embeds: [logEmbed], files: [file]}).catch(err => {
|
||||
message.reply(err)
|
||||
})
|
||||
|
||||
message.channel.delete().catch(error => {
|
||||
if (error.code !== Discord.Constants.APIErrors.UNKNOWN_CHANNEL) {
|
||||
console.error('Failed to delete the message:', error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
}).catch( () => {
|
||||
interaction.m.edit({content: 'The request to close the ticket has timed out.'}).then(m2 => setTimeout(() => channel.delete(3000)) );
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
if (!supportbot.CloseConfirmation) {
|
||||
|
||||
let logChannel = message.guild.channels.cache.find(channel => channel.name === supportbot.TranscriptLog) || message.guild.channels.cache.find(channel => channel.id === supportbot.TranscriptLog)
|
||||
let user = message.author;
|
||||
let reason = args.join(" ") || "No Reason Provided.";
|
||||
|
||||
let name = message.channel.name;
|
||||
let ticketChannel = message.channel;
|
||||
|
||||
message.channel.send(`**${supportbot.ClosingTicket}**`)
|
||||
|
||||
.then(() => {
|
||||
const logEmbed = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.TranscriptTitle)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter(supportbot.EmbedFooter)
|
||||
.addField("Closed By", message.author.tag)
|
||||
.addField("Reason", reason);
|
||||
|
||||
message.channel.messages.fetch({ limit: 100 }).then( msgs => {
|
||||
let html = '';
|
||||
|
||||
msgs = msgs.sort( ( a, b ) => a.createdTimestamp - b.createdTimestamp );
|
||||
html += `<strong>Server Name:</strong> ${message.guild.name}<br>`;
|
||||
html += `<strong>Ticket:</strong> ${ticketChannel.name}<br>`;
|
||||
html += `<strong>Message:</strong> ${msgs.size} Messages<br><br><br>`;
|
||||
|
||||
msgs.forEach( msg => {
|
||||
if ( msg.content ) {
|
||||
html += `<strong>User:</strong> ${msg.author.tag}<br>`;
|
||||
html += `<strong>Message:</strong> ${msg.content}<br>`;
|
||||
html += `-----<br><br>`;
|
||||
}
|
||||
});
|
||||
|
||||
logChannel.send({embeds: [logEmbed]}).catch(err => {
|
||||
message.reply(err)
|
||||
})
|
||||
|
||||
let file = new Discord.MessageAttachment( Buffer.from( html ), `${name}.html` )
|
||||
logChannel.send({embeds: [logEmbed], files: [file]}).catch(err => {
|
||||
message.reply(err)
|
||||
})
|
||||
|
||||
message.channel.delete().catch(error => {
|
||||
if (error.code !== Discord.Constants.APIErrors.UNKNOWN_CHANNEL) {
|
||||
console.error('Failed to delete the message:', error);
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
}).catch( () => {
|
||||
interaction.m.edit({content: 'The request to close the ticket has timed out.'}).then(m2 => setTimeout(() => channel.delete(3000)) );
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
@@ -1,85 +0,0 @@
|
||||
// SupportBot, Created by Emerald Services
|
||||
// Help Command
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = {
|
||||
name: supportbot.HelpCommand,
|
||||
description: supportbot.HelpDesc,
|
||||
|
||||
|
||||
execute(message, args) {
|
||||
if (supportbot.DeleteMessages) message.delete();
|
||||
|
||||
let SupportStaff = message.guild.roles.cache.find(adminRole => adminRole.name === supportbot.Staff) || message.guild.roles.cache.find(staffRole => staffRole.id === supportbot.Staff);
|
||||
let AdminStaff = message.guild.roles.cache.find(adminRole => adminRole.name === supportbot.Admin) || message.guild.roles.cache.find(adminRole => adminRole.id === supportbot.Admin);
|
||||
|
||||
if (supportbot.HelpMenu) {
|
||||
let generalCommands = "";
|
||||
generalCommands += `**${supportbot.Prefix}${supportbot.HelpCommand}** ${supportbot.HelpDesc}\n`;
|
||||
generalCommands += `**${supportbot.Prefix}${supportbot.LinksCommand}** ${supportbot.LinksDesc}\n`;
|
||||
generalCommands += `**${supportbot.Prefix}${supportbot.SuggestCommand}** ${supportbot.SuggestionDesc}\n`;
|
||||
generalCommands += `**${supportbot.Prefix}${supportbot.PingCommand}** ${supportbot.PingDesc}\n`;
|
||||
|
||||
let supportCommands = "";
|
||||
supportCommands += `**${supportbot.Prefix}${supportbot.NewTicket} [reason]** ${supportbot.NewTicketDesc}\n`
|
||||
supportCommands += `**${supportbot.Prefix}${supportbot.CloseTicket} [reason]** ${supportbot.CloseTicketDesc}\n`
|
||||
|
||||
let staffCommands = "";
|
||||
staffCommands += `**${supportbot.Prefix}${supportbot.AddUser} <user#0000>** ${supportbot.AddUserDesc}\n`
|
||||
staffCommands += `**${supportbot.Prefix}${supportbot.RemoveUser} <user#0000>** ${supportbot.RemoveUserDesc}\n`
|
||||
staffCommands += `**${supportbot.Prefix}${supportbot.BotSay}** ${supportbot.BotSayDesc}\n`
|
||||
staffCommands += `**${supportbot.Prefix}${supportbot.PurgeMessage}** ${supportbot.PurgeDesc}\n`
|
||||
staffCommands += `**${supportbot.Prefix}${supportbot.ChatLog}** ${supportbot.ChatLogDesc}\n`
|
||||
|
||||
let adminCommands = "";
|
||||
adminCommands += `**${supportbot.Prefix}${supportbot.AnnounceCommand}** ${supportbot.AnnounceDesc} \`Admin Only\`\n`
|
||||
adminCommands += `**${supportbot.Prefix}${supportbot.BanUser}** ${supportbot.BanDesc} \`Admin Only\` \n`
|
||||
adminCommands += `**${supportbot.Prefix}${supportbot.KickUser}** ${supportbot.KickDesc} \`Admin Only\` \n`
|
||||
adminCommands += `**${supportbot.Prefix}${supportbot.BlacklistUser}** ${supportbot.BlacklistDesc} \`Admin Only\` \n`
|
||||
|
||||
const HelpEmbed1 = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.Bot_Name)
|
||||
.setThumbnail(message.author.displayAvatarURL())
|
||||
|
||||
.addFields(
|
||||
{ name: '🖥️ General Commands\n', value: `${generalCommands}\n`, inline: false },
|
||||
{ name: '🎫 Support Commands\n', value: `${supportCommands}\n`, inline: false },
|
||||
)
|
||||
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter(supportbot.EmbedFooter, message.author.displayAvatarURL());
|
||||
|
||||
if (message.member.roles.cache.has(SupportStaff.id)) {
|
||||
HelpEmbed1.addFields(
|
||||
{ name: '🔐 Staff Commands\n', value: `${staffCommands}\n`, inline: false },
|
||||
)
|
||||
}
|
||||
|
||||
if (message.member.roles.cache.has(AdminStaff.id)) {
|
||||
HelpEmbed1.addFields(
|
||||
{ name: '🔐 Admin Commands\n', value: `${adminCommands}\n`, inline: false },
|
||||
)
|
||||
}
|
||||
|
||||
if (supportbot.SendHelpPage === "dm") {
|
||||
message.author.send({
|
||||
embeds: [HelpEmbed1]
|
||||
});
|
||||
}
|
||||
|
||||
if (supportbot.SendHelpPage === "channel") {
|
||||
message.channel.send({
|
||||
embeds: [HelpEmbed1]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
@@ -1,109 +0,0 @@
|
||||
// SupportBot, Created by Emerald Services
|
||||
// Say Command
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const { execute } = require("./help");
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = {
|
||||
name: supportbot.KickUser,
|
||||
description: supportbot.KickDesc,
|
||||
|
||||
execute(message, args, member) {
|
||||
if (supportbot.DeleteMessages) message.delete();
|
||||
|
||||
let SupportStaff = message.guild.roles.cache.find(adminRole => adminRole.name === supportbot.Admin) || message.guild.roles.cache.find(adminRole => adminRole.id === supportbot.Admin)
|
||||
|
||||
const NoPerms = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Permissions!")
|
||||
.setDescription(`${supportbot.IncorrectPerms}\n\nRole Required: \`${SupportStaff.name}\``)
|
||||
.setColor(supportbot.WarningColour)
|
||||
|
||||
if (!message.member.roles.cache.has(SupportStaff.id))
|
||||
return message.channel.send({ embeds: [NoPerms] });
|
||||
|
||||
let locateChannel = message.guild.channels.cache.find(ModLogChannel => ModLogChannel.name === supportbot.ModLogChannel) || message.guild.channels.cache.find(ModLogChannel => ModLogChannel.id === supportbot.ModLogChannel)
|
||||
|
||||
const errornochannel = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Channel")
|
||||
.setDescription(`${supportbot.InvalidChannel}\n\nChannel Required: \`${supportbot.ModLogChannel}\``)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
|
||||
if(!locateChannel) return message.channel.send({ embeds: [errornochannel] });
|
||||
|
||||
const user = message.mentions.members.first() || message.guild.members.cache.get(args[0]);
|
||||
|
||||
const embed1 = new Discord.MessageEmbed()
|
||||
.setDescription("> :x: Please provide a reason to kick.\n\n`Try Again!`")
|
||||
.setColor(supportbot.ErrorColour)
|
||||
|
||||
if (!args[0]) return message.channel.send({
|
||||
embeds: [embed1]
|
||||
});
|
||||
|
||||
const embed2 = new Discord.MessageEmbed()
|
||||
.setDescription("> :detective: **Hmm!** Can\'t seem tp find this user.\n\n`Are they in the server?`")
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
if (!user) return message.channel.send({
|
||||
embeds: [embed2]
|
||||
})
|
||||
|
||||
const embed3 = new Discord.MessageEmbed()
|
||||
.setDescription("> :x: **Err No!** Cannot punish this user!\n\n`Reason: Their permissions and or roles are greater than mine.`")
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
if(!user.kickable) return message.channel.send({
|
||||
embeds: [embed3]
|
||||
});
|
||||
|
||||
const embed4 = new Discord.MessageEmbed()
|
||||
.setDescription("> :joy: **OML!** Did you really just try to kick yourself!")
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
if(user.id === message.author.id) return message.channel.send({
|
||||
embeds: [embed4]
|
||||
});
|
||||
|
||||
let reason = args.slice(1).join(" ");
|
||||
|
||||
if(!reason) reason = 'No Reason Provided.';
|
||||
|
||||
const embed5 = new Discord.MessageEmbed()
|
||||
.setDescription("> :thinking: **Hmm** Something seems to have gone wrong.\n\n`Check your system for errors!`")
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
user.kick({ reason: `${reason}` }).catch(err => {
|
||||
message.channel.send({ embeds: [embed5] })
|
||||
console.log(err)
|
||||
})
|
||||
|
||||
|
||||
const successEmbed = new Discord.MessageEmbed()
|
||||
.setDescription(`> :white_check_mark: **OOF!** ${user} has been kicked!`)
|
||||
.setColor(supportbot.SuccessColour)
|
||||
|
||||
message.channel.send({
|
||||
embeds: [successEmbed]
|
||||
})
|
||||
|
||||
const logEmbed = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.KickTitle)
|
||||
.setThumbnail(supportbot.ModThumbnail)
|
||||
.addField('Kicked User:', user)
|
||||
.addField('Staff Member', message.author)
|
||||
.addField('Reason:', reason)
|
||||
.setFooter(supportbot.EmbedFooter)
|
||||
.setColor(supportbot.KickLogColour)
|
||||
.setTimestamp()
|
||||
|
||||
locateChannel.send({ embeds: [logEmbed] })
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
@@ -1,34 +0,0 @@
|
||||
// SupportBot, Created by Emerald Services
|
||||
// Links Command
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const { execute } = require("./help");
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = {
|
||||
name: supportbot.LinksCommand,
|
||||
description: supportbot.LinksDesc,
|
||||
|
||||
execute(message, args) {
|
||||
if (supportbot.DeleteMessages) message.delete();
|
||||
|
||||
const LinksEmbed = new Discord.MessageEmbed()
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
let botLinks = supportbot.LINKS;
|
||||
|
||||
let links = '';
|
||||
|
||||
for ( let name in botLinks ) {
|
||||
links += `[${name}](${botLinks[ name ]})\n`;
|
||||
};
|
||||
|
||||
LinksEmbed.addField(supportbot.LinksTitle, links)
|
||||
|
||||
message.channel.send({ embeds: [LinksEmbed] });
|
||||
|
||||
}
|
||||
};
|
||||
@@ -1,25 +0,0 @@
|
||||
// SupportBot, Created by Emerald Services
|
||||
// Ping Command
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = {
|
||||
name: supportbot.PingCommand,
|
||||
description: supportbot.PingDesc,
|
||||
|
||||
execute(message, args) {
|
||||
if (supportbot.DeleteMessages) message.delete();
|
||||
|
||||
let ping = Date.now() - message.createdTimestamp + " ms";
|
||||
|
||||
const PingCommandEmbed = new Discord.MessageEmbed()
|
||||
.setDescription(`🏓 **Pong!** \`${Date.now() - message.createdTimestamp}ms\``)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
message.channel.send({ embeds: [PingCommandEmbed] });
|
||||
}
|
||||
};
|
||||
@@ -1,79 +0,0 @@
|
||||
// SupportBot, Created by Emerald Services
|
||||
// Say Command
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const { execute } = require("./help");
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = {
|
||||
name: supportbot.PurgeMessage,
|
||||
description: supportbot.PurgeDesc,
|
||||
|
||||
execute(message, args, member) {
|
||||
if (supportbot.DeleteMessages) message.delete();
|
||||
|
||||
let SupportStaff = message.guild.roles.cache.find(adminRole => adminRole.name === supportbot.Staff) || message.guild.roles.cache.find(adminRole => adminRole.id === supportbot.Staff)
|
||||
const NoPerms = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Permissions!")
|
||||
.setDescription(`${supportbot.IncorrectPerms}\n\nRole Required: \`${SupportStaff}\``)
|
||||
.setColor(supportbot.WarningColour)
|
||||
|
||||
if (!message.member.roles.cache.has(supportbot.Staff))
|
||||
return message.channel.send({ embeds: [NoPerms] });
|
||||
|
||||
let locateChannel = message.guild.channels.cache.find(ModLogChannel => ModLogChannel.name === supportbot.ModLogChannel) || message.guild.channels.cache.find(ModLogChannel => ModLogChannel.id === supportbot.ModLogChannel)
|
||||
|
||||
const errornochannel = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Channel")
|
||||
.setDescription(`${supportbot.InvalidChannel}\n\nChannel Required: \`${supportbot.ModLogChannel}\``)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
|
||||
if(!locateChannel) return message.channel.send({ embeds: [errornochannel] });
|
||||
|
||||
const embed1 = new Discord.MessageEmbed()
|
||||
.setDescription(`> :thinking: **Hmm!** Please enter a valid number of message to purge!\n\n\`${supportbot.Prefix}${supportbot.PurgeMessage} <message count>\` `)
|
||||
.setColor(supportbot.WarningColour)
|
||||
|
||||
if (!args[0]) return message.channel.send({
|
||||
embeds: [embed1]
|
||||
});
|
||||
|
||||
const messagePrune = parseInt(args[0])
|
||||
|
||||
const embed2 = new Discord.MessageEmbed()
|
||||
.setDescription("> :person_facepalming: **Grr!** Can you count? That ain't a number :joy:")
|
||||
.setColor(supportbot.ErrorColour)
|
||||
|
||||
if (isNaN(messagePrune)) return message.reply({
|
||||
embeds: [embed2]
|
||||
})
|
||||
|
||||
message.channel.bulkDelete(messagePrune).then(() => {
|
||||
|
||||
const embed3 = new Discord.MessageEmbed()
|
||||
.setDescription(`> :recycle: \`${args[0]} messages\` **have been purged!** `)
|
||||
.setColor(supportbot.ErrorColour)
|
||||
message.channel.send({
|
||||
embeds: [embed3]
|
||||
})
|
||||
})
|
||||
|
||||
const logEmbed = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.PruneLogTitle)
|
||||
.setThumbnail(supportbot.PruneThumbnail)
|
||||
.addField('Messages Purged', `\`${args[0]} messages\``)
|
||||
.addField('Staff Member', `${message.author}`)
|
||||
.setFooter(supportbot.EmbedFooter)
|
||||
.setColor(supportbot.PruneColour)
|
||||
.setTimestamp()
|
||||
|
||||
locateChannel.send({ embeds: [logEmbed] })
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
@@ -1,62 +0,0 @@
|
||||
// SupportBot, Created by Emerald Services
|
||||
// Remove User
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = {
|
||||
name: supportbot.RemoveUser,
|
||||
description: supportbot.RemoveUserDesc,
|
||||
|
||||
execute(message, args) {
|
||||
if (supportbot.DeleteMessages) message.delete();
|
||||
|
||||
let SupportStaff = message.guild.roles.cache.find(SupportTeam => SupportTeam.name === supportbot.Staff) || message.guild.roles.cache.find(SupportTeam => SupportTeam.id === supportbot.Staff)
|
||||
let Admins = message.guild.roles.cache.find(AdminUser => AdminUser.name === supportbot.Admin) || message.guild.roles.cache.find(AdminUser => AdminUser.id === supportbot.Admin)
|
||||
|
||||
const NoPerms = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Permissions!")
|
||||
.setDescription(`${supportbot.IncorrectPerms}\n\nRole Required: \`${supportbot.Staff}\` or \`${supportbot.Admin}\``)
|
||||
.setColor(supportbot.WarningColour)
|
||||
|
||||
if (message.member.roles.cache.has(SupportStaff.id) || message.member.roles.cache.has(Admins.id)) {
|
||||
if (!message.channel.name.startsWith( `${supportbot.TicketChannel}-` )) {
|
||||
const Exists = new Discord.MessageEmbed()
|
||||
.setTitle("No Ticket Found!")
|
||||
.setDescription(`${supportbot.NoValidTicket}`)
|
||||
.setColor(supportbot.WarningColour);
|
||||
message.channel.send({ embeds: [Exists] });
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
let rUser = message.guild.member(message.mentions.users.first() || message.guild.members.cache.get(args[0]));
|
||||
const UserNotExist = new Discord.MessageEmbed()
|
||||
.setTitle("User Not Found!")
|
||||
.setDescription(`${supportbot.UserNotFound}\n\nTry Again:\`${supportbot.Prefix}${supportbot.RemoveUser} <user#0000>\``)
|
||||
.setColor(supportbot.ErrorColour)
|
||||
|
||||
if (!rUser) return message.channel.send({ embeds: [UserNotExist] });
|
||||
|
||||
message.channel.updateOverwrite(rUser, {
|
||||
VIEW_CHANNEL: false,
|
||||
CREATE_INVITE: false,
|
||||
SEND_MESSAGES: false,
|
||||
READ_MESSAGES: false
|
||||
});
|
||||
|
||||
const Complete = new Discord.MessageEmbed()
|
||||
.setTitle("User Removed!")
|
||||
.setDescription(supportbot.RemovedUser.replace(/%user%/g, rUser.id))
|
||||
.setTimestamp()
|
||||
.setColor(supportbot.EmbedColour)
|
||||
message.channel.send({ embeds: [Complete] });
|
||||
} else {
|
||||
return message.channel.send({ embeds: [NoPerms] });
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
@@ -1,70 +0,0 @@
|
||||
// SupportBot, Created by Emerald Services
|
||||
// Suggest Command
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = {
|
||||
name: supportbot.SuggestCommand,
|
||||
description: supportbot.SuggestionDesc,
|
||||
|
||||
execute(message, args) {
|
||||
if (supportbot.DeleteMessages) message.delete();
|
||||
|
||||
let locateChannel = message.guild.channels.cache.find(SuggestionChannel => SuggestionChannel.name === supportbot.SuggestionChannel) || message.guild.channels.cache.find(SuggestionChannel => SuggestionChannel.id === supportbot.SuggestionChannel)
|
||||
|
||||
const errornochannel = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Channel")
|
||||
.setDescription(`${supportbot.InvalidChannel}\n\nChannel Required: \`${supportbot.SuggestionChannel}\``)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
|
||||
if(!locateChannel) return message.channel.send({ embeds: [errornochannel] });
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setDescription(`> **${supportbot.SuggestionStarter}**`)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
message.channel.send({ embeds: [embed] });
|
||||
|
||||
let suggestion = []
|
||||
message.channel.awaitMessages(response => response.content.length > 2, {
|
||||
max: 1,
|
||||
time: 500000,
|
||||
errors: ['time'],
|
||||
}).then((collected) => {
|
||||
suggestion.push(collected.map(r => r.content));
|
||||
|
||||
const SuggestionMessage = new Discord.MessageEmbed()
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter(supportbot.EmbedFooter)
|
||||
|
||||
.addField(supportbot.SuggestionTitle, suggestion, true)
|
||||
.addField("From", `<@${message.author.id}>`, true)
|
||||
|
||||
if (supportbot.SuggestionMessage_Icon === "BOT") {
|
||||
SuggestionMessage.setThumbnail(bot.user.displayAvatarURL())
|
||||
}
|
||||
|
||||
if (supportbot.SuggestionMessage_Icon === "USER") {
|
||||
SuggestionMessage.setThumbnail(message.author.displayAvatarURL())
|
||||
}
|
||||
|
||||
if (supportbot.SuggestionMessage_Icon === "CUSTOM") {
|
||||
SuggestionMessage.setThumbnail(supportbot.SuggestionIcon_URL)
|
||||
}
|
||||
|
||||
locateChannel.send({ embeds: [SuggestionMessage] }).then(async function(msg) {
|
||||
msg.react(supportbot.SuggestReact_1).then(() => msg.react(supportbot.SuggestReact_2));
|
||||
});
|
||||
|
||||
const SuggestionComplete = new Discord.MessageEmbed()
|
||||
.setColor(supportbot.SuccessColour)
|
||||
.setDescription(`:white_check_mark: Your suggestion has been successfully created. <#${locateChannel.id}>`)
|
||||
message.channel.send({ embeds: [SuggestionComplete] })
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
@@ -1,242 +0,0 @@
|
||||
// SupportBot, Created by Emerald Services
|
||||
// Ticket Command
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const { MessageButton, MessageActionRow, Permissions } = require("discord.js");
|
||||
|
||||
const fs = require("fs")
|
||||
const yaml = require('js-yaml');
|
||||
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
const TicketNumberID = require('../utils/TicketNumber.js');
|
||||
|
||||
async function asyncForEach(array, callback) {
|
||||
for (let index = 0; index < array.length; index++) {
|
||||
await callback(array[index], index, array);
|
||||
}
|
||||
}
|
||||
module.exports = {
|
||||
name: supportbot.NewTicket,
|
||||
description: supportbot.NewTicketDesc,
|
||||
|
||||
async execute(message, args) {
|
||||
if (message.channel.name !== supportbot.ReactionChannel) {
|
||||
if (supportbot.DeleteMessages) message.delete();
|
||||
}
|
||||
|
||||
let reactionUser = message.guild.members.cache.get(message.author.id)
|
||||
|
||||
if (reactionUser.roles.cache.find(role => role.name === supportbot.TicketBlackListRole) || reactionUser.roles.cache.find(role => role.id === supportbot.TicketBlackListRole)) {
|
||||
return message.channel.send({content:`<@${message.author.id}> ${supportbot.TicketBlackListMessage}`}).then(msg => {
|
||||
setTimeout(() => msg.delete(), 3500)
|
||||
})
|
||||
}
|
||||
|
||||
// Ticket ID
|
||||
let ticketNumberID = TicketNumberID.pad(message.guild.id);
|
||||
|
||||
// Ticket Subject
|
||||
const TicketSubject = args || supportbot.NoTicketSubject;
|
||||
|
||||
const TicketExists = new Discord.MessageEmbed()
|
||||
.setTitle("Ticket Exists!")
|
||||
.setDescription(`${supportbot.TicketExists}`)
|
||||
.setColor(supportbot.WarningColour)
|
||||
|
||||
if (message.guild.channels.cache.find(ticketChannel => ticketChannel.name === `${supportbot.TicketChannel}-${ticketNumberID}`)) {
|
||||
return message.channel.send({ embeds: [TicketExists] });
|
||||
}
|
||||
const Staff = message.guild.roles.cache.find(SupportTeam => SupportTeam.name === supportbot.Staff) || message.guild.roles.cache.find(SupportTeam => SupportTeam.id === supportbot.Staff)
|
||||
const Admins = message.guild.roles.cache.find(AdminUser => AdminUser.name === supportbot.Admin) || message.guild.roles.cache.find(AdminUser => AdminUser.id === supportbot.Admin)
|
||||
const DeptRole1 = message.guild.roles.cache.find(DepartmentRole => DepartmentRole.name === `${supportbot.DepartmentRole_1}`) || message.guild.roles.cache.find(DepartmentRole => DepartmentRole.id === `${supportbot.DepartmentRole_1}`)
|
||||
const DeptRole2 = message.guild.roles.cache.find(DepartmentRole => DepartmentRole.name === `${supportbot.DepartmentRole_2}`) || message.guild.roles.cache.find(DepartmentRole => DepartmentRole.id === `${supportbot.DepartmentRole_2}`)
|
||||
const DeptRole3 = message.guild.roles.cache.find(DepartmentRole => DepartmentRole.name === `${supportbot.DepartmentRole_3}`) || message.guild.roles.cache.find(DepartmentRole => DepartmentRole.id === `${supportbot.DepartmentRole_3}`)
|
||||
const Author = message.author
|
||||
const Everyone = message.guild.id
|
||||
const ticketChannel = await message.guild.channels.create(`${supportbot.TicketChannel}-${ticketNumberID}`, {
|
||||
type: "GUILD_TEXT",
|
||||
})
|
||||
|
||||
if (message.channel.name === supportbot.ReactionChannel || message.channel.id === supportbot.ReactionChannel) {
|
||||
const CreatedTicket = new Discord.MessageEmbed()
|
||||
.setDescription(supportbot.TicketCreatedAlert.replace(/%ticketauthor%/g, message.author.id).replace(/%ticketid%/g, ticketChannel.id).replace(/%ticketusername%/g, message.author.username))
|
||||
.setColor(supportbot.EmbedColour)
|
||||
message.channel.send({embeds: [CreatedTicket]}).then(msg => {
|
||||
setTimeout(() => msg.delete(), 5000)
|
||||
})
|
||||
} else {
|
||||
const CreatedTicket = new Discord.MessageEmbed()
|
||||
.setDescription(supportbot.TicketCreatedAlert.replace(/%ticketauthor%/g, message.author.id).replace(/%ticketid%/g, ticketChannel.id).replace(/%ticketusername%/g, message.author.username))
|
||||
.setColor(supportbot.EmbedColour)
|
||||
message.channel.send({embeds: [CreatedTicket]}).then(msg => setTimeout(() => msg.delete(), 5000));
|
||||
}
|
||||
let AllowArr = [Staff, Staff, Admins, Author]
|
||||
await asyncForEach(AllowArr, (index) => {
|
||||
ticketChannel.permissionOverwrites.create(index, {VIEW_CHANNEL: true})
|
||||
})
|
||||
|
||||
let DenyArr = [Everyone]
|
||||
await asyncForEach(DenyArr, (index) => {
|
||||
ticketChannel.permissionOverwrites.create(index, {VIEW_CHANNEL: false})
|
||||
})
|
||||
|
||||
let TicketCategory = message.guild.channels.cache.find(category => category.name === supportbot.TicketCategory) || message.guild.channels.cache.find(category => category.id === supportbot.TicketCategory)
|
||||
if(TicketCategory) {
|
||||
ticketChannel.setParent(TicketCategory.id)
|
||||
}
|
||||
|
||||
if (supportbot.AllowTicketMentions) {
|
||||
ticketChannel.send({content:`${message.author}`})
|
||||
}
|
||||
|
||||
const TicketMessage = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.Ticket_Title.replace(/%ticketauthor%/g, message.author.id).replace(/%ticketid%/g, ticketChannel.id).replace(/%ticketusername%/g, message.author.username))
|
||||
.setDescription(supportbot.TicketMessage.replace(/%ticketauthor%/g, message.author.id).replace(/%ticketid%/g, ticketChannel.id).replace(/%ticketusername%/g, message.author.username))
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
if (supportbot.TicketSubject === "embed") {
|
||||
|
||||
if (TicketSubject != 'No Reason Provided.') {
|
||||
TicketMessage.addFields({ name: 'Reason', value: TicketSubject })
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (supportbot.TicketSubject === "description") {
|
||||
|
||||
if (TicketSubject != 'No Reason Provided.') {
|
||||
ticketChannel.setTopic(`Reason: ${TicketSubject} - User ID: ${message.author.id} - Ticket: ${ticketChannel.name}`)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (supportbot.TicketDepartments) {
|
||||
TicketMessage.addFields({ name: 'Departments', value: ` **${supportbot.DepartmentTitle_1}**\n **${supportbot.DepartmentTitle_2}**\n **${supportbot.DepartmentTitle_3}**` })
|
||||
}
|
||||
const CloseButton = new MessageButton()
|
||||
.setCustomId('ticketclose')
|
||||
.setLabel('Close')
|
||||
.setStyle(supportbot.TicketCloseColour)
|
||||
.setEmoji(supportbot.TicketCloseEmoji)
|
||||
|
||||
const LockButton = new MessageButton()
|
||||
.setCustomId('ticketlock')
|
||||
.setLabel('Lock')
|
||||
.setStyle(supportbot.TicketLockColour)
|
||||
.setEmoji(supportbot.TicketLockEmoji)
|
||||
|
||||
const row2 = new MessageActionRow()
|
||||
.addComponents(CloseButton, LockButton)
|
||||
|
||||
if(supportbot.TicketDepartments) {
|
||||
|
||||
let DenyArr = [DeptRole1, DeptRole2, DeptRole3]
|
||||
await asyncForEach(DenyArr, (index) => {
|
||||
ticketChannel.permissionOverwrites.create(index, {VIEW_CHANNEL: false})
|
||||
})
|
||||
const Department1Button = new MessageButton()
|
||||
.setCustomId('Department1')
|
||||
.setLabel(`${supportbot.DepartmentTitle_1}`)
|
||||
.setStyle(supportbot.TicketDept1Colour)
|
||||
.setEmoji(supportbot.TicketDept1Emoji)
|
||||
|
||||
const Department2Button = new MessageButton()
|
||||
.setCustomId('Department2')
|
||||
.setLabel(`${supportbot.DepartmentTitle_2}`)
|
||||
.setStyle(supportbot.TicketDept2Colour)
|
||||
.setEmoji(supportbot.TicketDept2Emoji)
|
||||
|
||||
const Department3Button = new MessageButton()
|
||||
.setCustomId('Department3')
|
||||
.setLabel(`${supportbot.DepartmentTitle_3}`)
|
||||
.setStyle(supportbot.TicketDept3Colour)
|
||||
.setEmoji(supportbot.TicketDept3Emoji)
|
||||
|
||||
const row = new MessageActionRow()
|
||||
.addComponents(Department1Button, Department2Button, Department3Button)
|
||||
|
||||
const m = await ticketChannel.send({embeds: [TicketMessage], components: [row]})
|
||||
|
||||
const filter = i => {
|
||||
i.deferUpdate();
|
||||
return i.user.id === message.author.id;
|
||||
};
|
||||
const collector = m.createMessageComponentCollector({ filter, max: 1, componentType: 'BUTTON', time: 60000 });
|
||||
|
||||
collector.on('collect',async (i) => {
|
||||
|
||||
if(i.customId === 'Department1') {
|
||||
|
||||
ticketChannel.permissionOverwrites.edit(DeptRole1, {
|
||||
VIEW_CHANNEL: true,
|
||||
READ_MESSAGE_HISTORY: true,
|
||||
SEND_MESSAGES: true,
|
||||
})
|
||||
|
||||
if(!supportbot.AllowStaff) {
|
||||
ticketChannel.permissionOverwrites.edit(Staff, { VIEW_CHANNEL: false, READ_MESSAGE_HISTORY: false, SEND_MESSAGES: false })
|
||||
}
|
||||
|
||||
const Department1 = new Discord.MessageEmbed()
|
||||
.setDescription(`> Thank for reaching out to the **${supportbot.DepartmentTitle_1} Department**. Please provide us information regarding your query.`)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
ticketChannel.send({ embeds: [Department1] });
|
||||
|
||||
if (supportbot.AllowTicketMentions) {
|
||||
ticketChannel.send({content: `@here`})
|
||||
}
|
||||
}
|
||||
i.message.edit({embeds: [TicketMessage], components: [row2]})
|
||||
|
||||
if(i.customId === 'Department2') {
|
||||
|
||||
ticketChannel.permissionOverwrites.edit(DeptRole2, {
|
||||
VIEW_CHANNEL: true,
|
||||
READ_MESSAGE_HISTORY: true,
|
||||
SEND_MESSAGES: true,
|
||||
})
|
||||
|
||||
if(!supportbot.AllowStaff) {
|
||||
ticketChannel.permissionOverwrites.edit(Staff, { VIEW_CHANNEL: false, READ_MESSAGE_HISTORY: false, SEND_MESSAGES: false })
|
||||
}
|
||||
|
||||
|
||||
const Department2 = new Discord.MessageEmbed()
|
||||
.setDescription(`> Thank for reaching out to the **${supportbot.DepartmentTitle_2} Department**. Please provide us information regarding your query.`)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
ticketChannel.send({ embeds: [Department2] });
|
||||
|
||||
if (supportbot.AllowTicketMentions) {
|
||||
ticketChannel.send({content: `@here`})
|
||||
}
|
||||
|
||||
i.message.edit({embeds: [TicketMessage], components: [row2]})
|
||||
}
|
||||
if(i.customId === 'Department3') {
|
||||
|
||||
ticketChannel.permissionOverwrites.edit(DeptRole3, {
|
||||
VIEW_CHANNEL: true,
|
||||
READ_MESSAGE_HISTORY: true,
|
||||
SEND_MESSAGES: true,
|
||||
})
|
||||
|
||||
if(!supportbot.AllowStaff) {
|
||||
ticketChannel.permissionOverwrites.edit(Staff, { VIEW_CHANNEL: false, READ_MESSAGE_HISTORY: false, SEND_MESSAGES: false })
|
||||
}
|
||||
|
||||
const Department3 = new Discord.MessageEmbed()
|
||||
.setDescription(`> Thank for reaching out to the **${supportbot.DepartmentTitle_3} Department**. Please provide us information regarding your query.`)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
ticketChannel.send({ embeds: [Department3] });
|
||||
|
||||
if (supportbot.AllowTicketMentions) {
|
||||
ticketChannel.send({content: `@here`})
|
||||
}
|
||||
i.message.edit({embeds: [TicketMessage], components: [row2]})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
ticketChannel.send({embeds: [TicketMessage], components: [row2]})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
|
||||
// SupportBot, Created by Emerald Services
|
||||
// Announce
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
const yaml = require('js-yaml');
|
||||
const { execute } = require("./help");
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
module.exports = {
|
||||
name: supportbot.ChatLog,
|
||||
description: supportbot.ChatLogDesc,
|
||||
execute(message, args) {
|
||||
if (supportbot.DeleteMessages) message.delete();
|
||||
let name = message.channel.name;
|
||||
|
||||
message.channel.messages.fetch({ limit: 100 }).then( msgs => {
|
||||
let html = '';
|
||||
|
||||
msgs = msgs.sort( ( a, b ) => a.createdTimestamp - b.createdTimestamp );
|
||||
html += `<strong>--- Channel Transcript ---</strong><br>`;
|
||||
html += `<strong>Server Name:</strong> ${message.guild.name}<br>`;
|
||||
html += `<strong>Channel:</strong> ${name}<br>`;
|
||||
html += `<strong>Message:</strong> ${msgs.size} Messages<br><br><br>`;
|
||||
|
||||
msgs.forEach( msg => {
|
||||
if ( msg.content ) {
|
||||
html += `<strong>User:</strong> ${msg.author.tag}<br>`;
|
||||
html += `<strong>Message:</strong> ${msg.content}<br>`;
|
||||
html += `-----<br><br>`;
|
||||
}
|
||||
});
|
||||
|
||||
const TranscriptSavedEmbed = new Discord.MessageEmbed()
|
||||
.setDescription(supportbot.ChatLogSavedMessage)
|
||||
.setColor(supportbot.SuccessColour)
|
||||
message.channel.send({embeds: [TranscriptSavedEmbed]})
|
||||
const errornochannel = new Discord.MessageEmbed()
|
||||
.setTitle("SupportBot Error!")
|
||||
.setDescription(`:x: **Error!** Channel not Found, This command cannot be executed proberbly as their is no channel within this server.\nThis is configurable via **supportbot-config.yml**\n\nChannel Required: \`${supportbot.ChatLogChannel}\`\n\nError Code: \`SB-03\``)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
|
||||
const ChatLogs = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.ChatLog_Title)
|
||||
.setThumbnail(supportbot.ChatLog_Thumbnail)
|
||||
.addFields(
|
||||
{ name: 'Channel', value: `<#${message.channel.id}>` },
|
||||
{ name: 'User', value: `<@${message.author.id}>` },
|
||||
)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter(supportbot.EmbedFooter)
|
||||
let locateChannel = message.guild.channels.cache.find(LocateChannel => LocateChannel.name === supportbot.ChatLogChannel) || message.guild.channels.cache.find(LocateChannel => LocateChannel.id === supportbot.ChatLogChannel)
|
||||
|
||||
if(!locateChannel) return message.channel.send({ embeds: [errornochannel] });
|
||||
|
||||
let file = new Discord.MessageAttachment( Buffer.from( html ), `${name}.html` )
|
||||
locateChannel.send({embeds: [ChatLogs], files: [file]})
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
// SupportBot 6.0, Created by Emerald Services
|
||||
// Ready Event
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = async (bot, member) => {
|
||||
|
||||
if (supportbot.SystemMessages) {
|
||||
const SystemChannel = member.guild.channels.cache.find(channel => channel.name === supportbot.UserJoined_Channel) || member.guild.channels.cache.get(supportbot.UserJoined_Channel)
|
||||
|
||||
if (!SystemChannel) return;
|
||||
|
||||
console.log(`[${supportbot.Bot_Name}]: ${member.user.username} has joined ${member.guild.name}!`)
|
||||
console.log(supportbot.AutoRole_Role)
|
||||
|
||||
const role = member.guild.roles.cache.find(role => role.name === supportbot.AutoRole_Role) || member.guild.roles.cache.find(role => role.id === supportbot.AutoRole_Role)
|
||||
|
||||
member.roles.add(role).catch(console.error);
|
||||
|
||||
if (supportbot.SystemMessage_Type === "embed") {
|
||||
|
||||
const GuildAddMember = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.Welcome_Title)
|
||||
.setDescription(supportbot.WelcomeMessage.replace(/%member%/g, `<@!${member.user.id}>`).replace(/%guildname%/g, member.guild.name))
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
if (supportbot.SystemMessage_Icon === "BOT") {
|
||||
GuildAddMember.setThumbnail(bot.user.displayAvatarURL())
|
||||
}
|
||||
|
||||
if (supportbot.SystemMessage_Icon === "USER") {
|
||||
GuildAddMember.setThumbnail(member.user.displayAvatarURL())
|
||||
}
|
||||
|
||||
if (supportbot.SystemMessage_Icon === "CUSTOM") {
|
||||
SuggestionMessage.setThumbnail(supportbot.SystemMessageIcon_URL)
|
||||
}
|
||||
|
||||
|
||||
if (supportbot.SystemMessage_EmbedFooter) {
|
||||
GuildAddMember.setFooter(supportbot.EmbedFooter)
|
||||
}
|
||||
|
||||
SystemChannel.send({ embeds: [GuildAddMember] });
|
||||
|
||||
}
|
||||
|
||||
if (supportbot.SystemMessage_Type === "normal") {
|
||||
SystemChannel.send({content: supportbot.WelcomeMessage.replace(/%member%/g, member.user.username).replace(/%guildname%/g, member.guild.name)})
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
@@ -1,51 +0,0 @@
|
||||
// SupportBot 6.0, Created by Emerald Services
|
||||
// Ready Event
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = async (bot, member) => {
|
||||
|
||||
if (supportbot.SystemMessages) {
|
||||
const SystemChannel = member.guild.channels.cache.find(channel => channel.name === supportbot.UserDeparted_Channel) || member.guild.channels.cache.get(supportbot.UserDeparted_Channel)
|
||||
|
||||
if (!SystemChannel) return;
|
||||
|
||||
console.log(`\u001b[31m.`, `[${supportbot.Bot_Name}]: ${member.user.username} has left ${member.guild.name}!`)
|
||||
|
||||
if (supportbot.UserDeparted_Type === "embed") {
|
||||
const GuildRemoveMember = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.Departed_Title)
|
||||
.setDescription(supportbot.DepartedMessage.replace(/%member%/g, member.user.username).replace(/%guildname%/g, member.guild.name))
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
if (supportbot.SystemMessage_Icon === "BOT") {
|
||||
GuildRemoveMember.setThumbnail(bot.user.displayAvatarURL())
|
||||
}
|
||||
|
||||
if (supportbot.SystemMessage_Icon === "USER") {
|
||||
GuildRemoveMember.setThumbnail(member.user.displayAvatarURL())
|
||||
}
|
||||
|
||||
if (supportbot.SystemMessage_Icon === "CUSTOM") {
|
||||
SuggestionMessage.setThumbnail(supportbot.SystemMessageIcon_URL)
|
||||
}
|
||||
|
||||
if (supportbot.SystemMessage_EmbedFooter) {
|
||||
GuildRemoveMember.setFooter(supportbot.EmbedFooter)
|
||||
}
|
||||
|
||||
SystemChannel.send({ embeds: [GuildRemoveMember] });
|
||||
|
||||
}
|
||||
|
||||
if (supportbot.SystemMessage_Type === "normal") {
|
||||
SystemChannel.send({content: supportbot.DepartedMessage.replace(/%member%/g, member.user.username).replace(/%guildname%/g, member.guild.name)})
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
@@ -1,128 +0,0 @@
|
||||
// SupportBot Interaction Event
|
||||
// SupportBot Created by Emerald Services
|
||||
|
||||
const fs = require("fs");
|
||||
const { MessageEmbed, MessageAttachment, Permissions, MessageButton, MessageActionRow } = require("discord.js");
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = async (bot, interaction, args) => {
|
||||
|
||||
if (interaction.isCommand()) return;
|
||||
|
||||
if(interaction.isButton()) {
|
||||
if(interaction.customId === 'openticket') {
|
||||
interaction.message.fetch()
|
||||
interaction.deferUpdate()
|
||||
let message = {
|
||||
guild: bot.guilds.cache.get(interaction.message.guildId),
|
||||
author: bot.users.cache.get(interaction.user.id),
|
||||
content: "N/A",
|
||||
channel: bot.channels.cache.get(interaction.message.channelId)
|
||||
}
|
||||
try {
|
||||
const cmd = bot.commands.get(supportbot.NewTicket);
|
||||
if(!cmd) return;
|
||||
cmd.execute(message, message.content)
|
||||
}
|
||||
catch (error){
|
||||
console.error(error)
|
||||
}
|
||||
}
|
||||
if(interaction.customId === 'ticketclose') {
|
||||
if(interaction.channel.name.startsWith(`${supportbot.TicketChannel}-`)) {
|
||||
interaction.message.fetch()
|
||||
interaction.deferUpdate()
|
||||
const DeleteTicketEmbed = new MessageEmbed()
|
||||
.setDescription(supportbot.TicketDeleteMessage)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
interaction.channel.send({embeds: [DeleteTicketEmbed]})
|
||||
|
||||
let logChannel = interaction.guild.channels.cache.find(channel => channel.name === supportbot.TranscriptLog) || interaction.guild.channels.cache.find(channel => channel.id === supportbot.TranscriptLog)
|
||||
|
||||
let user = interaction.user
|
||||
let name = interaction.channel.name;
|
||||
let ticketChannel = interaction.channel
|
||||
let reason = "No Reason Provided."
|
||||
|
||||
interaction.channel.send({content: `**${supportbot.ClosingTicket}**`})
|
||||
.then(() => {
|
||||
const logEmbed = new MessageEmbed()
|
||||
.setTitle(supportbot.TranscriptTitle)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter(supportbot.EmbedFooter)
|
||||
.addField("Closed By", user.username)
|
||||
.addField("Reason", reason)
|
||||
|
||||
interaction.channel.messages.fetch({limit: 100}).then(msgs => {
|
||||
let html = ''
|
||||
|
||||
msgs = msgs.sort( ( a, b ) => a.createdTimestamp - b.createdTimestamp );
|
||||
html += `<strong>Server Name:</strong> ${interaction.guild.name}<br>`
|
||||
html += `<strong>Ticket:</strong> ${ticketChannel.name}<br>`
|
||||
html += `<strong>Message:</strong> ${msgs.size} Messages<br><br><br>`
|
||||
|
||||
|
||||
msgs.forEach(msg => {
|
||||
if(msg.content) {
|
||||
html += `<strong>User:</strong> ${msg.author.tag}<br>`;
|
||||
html += `<strong>Message:</strong> ${msg.content}<br>`;
|
||||
html += `-----<br><br>`;
|
||||
}
|
||||
})
|
||||
|
||||
const TranscriptSavedEmbed = new MessageEmbed()
|
||||
.setDescription(supportbot.TranscriptSavedMessage)
|
||||
.setColor(supportbot.SuccessColour)
|
||||
interaction.channel.send({embeds: [TranscriptSavedEmbed]})
|
||||
|
||||
let file = new MessageAttachment( Buffer.from( html ), `${name}.html` )
|
||||
logChannel.send({embeds: [logEmbed], files: [file]})
|
||||
|
||||
setTimeout(() => interaction.channel.delete(), supportbot.TicketDeleteTime)
|
||||
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
if(interaction.customId === 'ticketlock') {
|
||||
if(interaction.channel.name.startsWith(`${supportbot.TicketChannel}`)) {
|
||||
interaction.message.fetch()
|
||||
interaction.deferUpdate()
|
||||
let Admin = interaction.guild.roles.cache.find(AdminUser => AdminUser.name === supportbot.Admin) || interaction.guild.roles.cache.find(AdminUser => AdminUser.id === supportbot.Admin)
|
||||
let all = interaction.channel.permissionOverwrites.cache
|
||||
|
||||
let parent = interaction.guild.channels.cache.find(c => c.name === `${supportbot.LockTicketCategory}`) || interaction.guild.channels.cache.find(c => c.id === `${supportbot.LockTicketCategory}`)
|
||||
if(parent) {
|
||||
interaction.channel.setParent(parent.id)
|
||||
}
|
||||
|
||||
all.forEach(perm => {
|
||||
interaction.channel.permissionOverwrites.delete(perm.id)
|
||||
|
||||
})
|
||||
interaction.channel.permissionOverwrites.create(Admin.id, {VIEW_CHANNEL: true})
|
||||
|
||||
interaction.channel.permissionOverwrites.create(interaction.guild.id, {VIEW_CHANNEL: false})
|
||||
|
||||
|
||||
const ticketDeleteButton = new MessageButton()
|
||||
.setCustomId('ticketclose')
|
||||
.setLabel('Close')
|
||||
.setStyle(supportbot.TicketDeleteColour)
|
||||
.setEmoji(supportbot.TicketDeleteEmoji)
|
||||
|
||||
const row = new MessageActionRow()
|
||||
.addComponents(ticketDeleteButton)
|
||||
const ArchiveEmbed = new MessageEmbed()
|
||||
.setTitle("Archived")
|
||||
.setDescription(`Archived ${interaction.channel.name}`)
|
||||
.setColor(`${supportbot.SuccessColour}`)
|
||||
|
||||
interaction.channel.send({embeds: [ArchiveEmbed]})
|
||||
interaction.message.edit({components: [row]})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
// SupportBot 6.0, Created by Emerald Services
|
||||
// Message Event
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = async (bot, message) => {
|
||||
if(message.author.bot) return;
|
||||
if(message.channel.type === "dm") return;
|
||||
if (message.content.indexOf(supportbot.Prefix) !== 0) return;
|
||||
|
||||
let messageArray = message.content.split(" ");
|
||||
const args = message.content.slice(supportbot.Prefix.length).trim().split(/ +/g);
|
||||
const command = args.shift().toLowerCase();
|
||||
|
||||
console.log(`\u001b[32m`, `[${supportbot.Bot_Name}]`, `\u001b[36m`, `${message.author.tag}`, `\u001b[33m`, `has executed the command`, `\u001b[36m`,`${supportbot.Prefix}${command}`)
|
||||
|
||||
const cmd = bot.commands.get(command);
|
||||
if(!cmd) return;
|
||||
cmd.execute(message, args);
|
||||
};
|
||||
@@ -1,36 +0,0 @@
|
||||
// SupportBot 6.0, Created by Emerald Services
|
||||
// Message Reaction Event
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
const tickets = yaml.load(fs.readFileSync('./storage/ticketreaction.yml', 'utf8'));
|
||||
|
||||
module.exports = async (client, reaction, user) => {
|
||||
|
||||
let message = {
|
||||
guild: reaction.message.channel.guild,
|
||||
author: user,
|
||||
content: "N/A",
|
||||
channel: reaction.message.channel
|
||||
}
|
||||
|
||||
if (supportbot.ReactionTickets) {
|
||||
if (reaction.message.id === tickets.ReactionMessage_ID) {
|
||||
if (reaction.emoji.name == supportbot.ReactionEmoji || reaction.emoji.id == supportbot.ReactionEmoji) {
|
||||
await reaction.users.remove(user.id)
|
||||
|
||||
try {
|
||||
const cmd = client.commands.get(supportbot.NewTicket);
|
||||
if(!cmd) return;
|
||||
|
||||
cmd.execute(message, message.content);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,26 +0,0 @@
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
|
||||
|
||||
module.exports = async (bot, message, packet) => {
|
||||
if (!['MESSAGE_REACTION_ADD', 'MESSAGE_REACTION_REMOVE'].includes(packet.t)) return;
|
||||
|
||||
const channel = bot.channels.cache.get(packet.d.channel_id);
|
||||
if (channel.messages.has(packet.d.message_id)) return;
|
||||
|
||||
channel.messages.fetch(packet.d.message_id).then(message => {
|
||||
const emoji = packet.d.emoji.id ? `${packet.d.emoji.name}:${packet.d.emoji.id}` : packet.d.emoji.name;
|
||||
const reaction = message.reactions.get(emoji);
|
||||
if (reaction) reaction.users.set(packet.d.user_id, bot.users.get(packet.d.user_id));
|
||||
if (packet.t === 'MESSAGE_REACTION_ADD') {
|
||||
bot.emit('messageReactionAdd', reaction, bot.users.get(packet.d.user_id));
|
||||
}
|
||||
if (packet.t === 'MESSAGE_REACTION_REMOVE') {
|
||||
bot.emit('messageReactionRemove', reaction, bot.users.get(packet.d.user_id));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
// SupportBot 6.0, Created by Emerald Services
|
||||
// Ready Event
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
const { MessageActionRow, MessageButton } = require('discord.js');
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
const tickets = yaml.load(fs.readFileSync('./storage/ticketreaction.yml', 'utf8'));
|
||||
|
||||
|
||||
module.exports = async bot => {
|
||||
bot.user.setActivity(supportbot.BotActivity, {
|
||||
type: supportbot.ActivityType,
|
||||
url: supportbot.StreamingURL
|
||||
});
|
||||
|
||||
console.log(`\u001b[32m`, `┏━━━┓╋╋╋╋╋╋╋╋╋╋╋╋╋┏┓┏━━┓╋╋╋┏┓`)
|
||||
console.log(`\u001b[32m`, `┃┏━┓┃╋╋╋╋╋╋╋╋╋╋╋╋┏┛┗┫┏┓┃╋╋┏┛┗┓`)
|
||||
console.log(`\u001b[32m`, `┃┗━━┳┓┏┳━━┳━━┳━━┳┻┓┏┫┗┛┗┳━┻┓┏┛`)
|
||||
console.log(`\u001b[32m`, `┗━━┓┃┃┃┃┏┓┃┏┓┃┏┓┃┏┫┃┃┏━┓┃┏┓┃┃`)
|
||||
console.log(`\u001b[32m`, `┃┗━┛┃┗┛┃┗┛┃┗┛┃┗┛┃┃┃┗┫┗━┛┃┗┛┃┗┓`)
|
||||
console.log(`\u001b[32m`, `┗━━━┻━━┫┏━┫┏━┻━━┻┛┗━┻━━━┻━━┻━┛`)
|
||||
console.log(`\u001b[32m`, `┗╋╋╋╋╋╋╋┃┃╋┃┃`)
|
||||
console.log(`\u001b[32m`, `╋╋╋╋╋╋╋┗┛╋┗┛`)
|
||||
console.log(` `)
|
||||
console.log(`\u001b[31m`, `――――――――――――――――――――――――――――――――――――――――――――`)
|
||||
console.log(` `)
|
||||
console.log(`\u001b[33m`, `${supportbot.Bot_Name} v${supportbot.SupportBot_Version}`, `\u001b[36m`, `Connected to Discord`)
|
||||
console.log(`\u001b[33m`, `Documentation:`, `\u001b[36m`, `https://supportbot.emeraldsrv.dev`)
|
||||
console.log(`\u001b[33m`, `Discord:`, `\u001b[36m`, `https://emeraldsrv.dev/discord`)
|
||||
console.log(`\u001b[33m`, `Hosting:`, `\u001b[36m`, `https://emeraldsrv.dev/hosting`)
|
||||
console.log(` `)
|
||||
console.log(`\u001b[37m`, `SupportBot proudly created by Emerald Services`)
|
||||
console.log(` `)
|
||||
console.log(`\u001b[31m`, `――――――――――――――――――――――――――――――――――――――――――――`)
|
||||
|
||||
|
||||
|
||||
if (supportbot.ReactionTickets) {
|
||||
let chan1 = bot.channels.cache.find(channel => channel.name === supportbot.ReactionChannel)
|
||||
|
||||
if (!chan1) {
|
||||
console.log('\u001b[33m', "[WARN] Ticket reaction panel is not setup, You can do so via the configuration file!")
|
||||
return false;
|
||||
}
|
||||
|
||||
chan1.messages.fetch(tickets.ReactionMessage_ID).catch(async r => {
|
||||
let embed = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.ReactionMessage.replace(/%reaction_emoji%/g, supportbot.ReactionEmoji))
|
||||
.setColor(supportbot.SuccessColour)
|
||||
.setFooter(supportbot.EmbedFooter);
|
||||
|
||||
if (supportbot.ReactionPanel_Description) {
|
||||
embed.setDescription(supportbot.ReactionDescription)
|
||||
}
|
||||
|
||||
if (supportbot.ReactionPanel_Thumbnail) {
|
||||
embed.setThumbnail(supportbot.ReactionThumbnail)
|
||||
}
|
||||
|
||||
if (supportbot.ReactionPanel_Image) {
|
||||
embed.setImage(supportbot.ReactionImage)
|
||||
}
|
||||
|
||||
let button = new MessageButton()
|
||||
.setLabel('Open Ticket')
|
||||
.setCustomId('openticket')
|
||||
.setStyle('PRIMARY')
|
||||
|
||||
let row = new MessageActionRow()
|
||||
.addComponents(button)
|
||||
|
||||
|
||||
await chan1.send({
|
||||
embeds: [embed],
|
||||
components: [row]
|
||||
}).then(r => {
|
||||
let data = {
|
||||
"ReactionMessage_ID": `${r.id}`
|
||||
}
|
||||
let yamlStr = yaml.dump(data);
|
||||
fs.writeFileSync('./storage/ticketreaction.yml', yamlStr, 'utf8');
|
||||
|
||||
}).catch(e => {
|
||||
console.log("Raw"+e)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
};
|
||||
@@ -1,112 +1,23 @@
|
||||
// ___ _ ___ _
|
||||
// / __> _ _ ___ ___ ___ _ _ _| |_ | . > ___ _| |_
|
||||
// \__ \| | || . \| . \/ . \| '_> | | | . \/ . \ | |
|
||||
// <___/`___|| _/| _/\___/|_| |_| |___/\___/ |_|
|
||||
// |_| |_|
|
||||
// ___ _ ___ _
|
||||
// / __> _ _ ___ ___ ___ _ _ _| |_ | . > ___ _| |_
|
||||
// \__ \| | || . \| . \/ . \| '_> | | | . \/ . \ | |
|
||||
// <___/`___|| _/| _/\___/|_| |_| |___/\___/ |_|
|
||||
// |_| |_|
|
||||
//
|
||||
// SupportBot created by Emerald Services
|
||||
// Installed with MIT License
|
||||
//
|
||||
// Discord Support: https://emeraldsrv.dev/discord
|
||||
|
||||
// const Discord = require("discord.js");
|
||||
const { Client, Intents, Collection } = require("discord.js");
|
||||
// Community Resources: https://emeraldsrv.dev/resources
|
||||
|
||||
const fs = require("fs");
|
||||
|
||||
const bot = new Client({
|
||||
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES]
|
||||
});
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(
|
||||
fs.readFileSync("./Configs/supportbot.yml", "utf8")
|
||||
);
|
||||
|
||||
const { REST } = require('@discordjs/rest');
|
||||
const Client = require("./Structures/Client.js");
|
||||
const client = new Client({});
|
||||
|
||||
bot.commands = new Collection();
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
const { promisify } = require("util");
|
||||
const readdir = promisify(require("fs").readdir);
|
||||
|
||||
String.prototype.toProperCase = function () {
|
||||
return this.replace(
|
||||
/([^\W_]+[^\s-]*) */g,
|
||||
(txt) => txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase()
|
||||
);
|
||||
};
|
||||
|
||||
const init = async () => {
|
||||
const evtFiles = await readdir("./events/");
|
||||
|
||||
console.info(`\u001b[36m`, `➢ SupportBot Events`);
|
||||
console.info(` `);
|
||||
|
||||
evtFiles.forEach((file, i) => {
|
||||
const eventName = file.split(".")[0];
|
||||
const event = require(`./events/${file}`);
|
||||
console.info(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[36m`, `#${i + 1} Event Loaded: ${eventName.toProperCase()} `);
|
||||
|
||||
bot.on(eventName, event.bind(null, bot));
|
||||
delete require.cache[require.resolve(`./events/${file}`)];
|
||||
});
|
||||
|
||||
console.info(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[36m`, `Successfully loaded ${evtFiles.length} events.`);
|
||||
console.log(`\u001b[31m`, `――――――――――――――――――――――――――――――――――――――――――――`)
|
||||
console.log(` `)
|
||||
};
|
||||
|
||||
init();
|
||||
|
||||
fs.readdir("./commands/", async (err, files) => {
|
||||
|
||||
console.info(`\u001b[36m`, `➢ SupportBot Commands`);
|
||||
console.info(` `);
|
||||
|
||||
if (err) console.info(err, "error");
|
||||
|
||||
let jsfiles = files.filter((f) => f.split(".").pop() === "js");
|
||||
|
||||
if (jsfiles.length <= 0) {
|
||||
console.log(`[${supportbot.Bot_Name}]: No commands found. Try to Re-download the resource`);
|
||||
return;
|
||||
}
|
||||
|
||||
jsfiles.forEach((f, i) => {
|
||||
let props = require(`./commands/${f}`);
|
||||
|
||||
console.info(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[36m`, `#${i + 1} Command Loaded: ${props.name.toProperCase()}`);
|
||||
bot.commands.set(props.name, props);
|
||||
});
|
||||
|
||||
console.info(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[36m`, `Loaded ${jsfiles.length} commands!`);
|
||||
console.log(`\u001b[31m`, `――――――――――――――――――――――――――――――――――――――――――――`)
|
||||
console.log(` `)
|
||||
});
|
||||
|
||||
fs.readdir("./addons/", (err, files) => {
|
||||
|
||||
console.info(`\u001b[36m`, `➢ SupportBot Addons`);
|
||||
console.info(` `);
|
||||
|
||||
if (err) console.info(err, "error");
|
||||
|
||||
let jsfiles = files.filter((f) => f.split(".").pop() === "js");
|
||||
|
||||
if (jsfiles.length <= 0) {
|
||||
console.log(`[${supportbot.Bot_Name}]: No addons found. You can download addons from https://emeraldsrv.dev`);
|
||||
return;
|
||||
}
|
||||
|
||||
jsfiles.forEach((f, i) => {
|
||||
let props = require(`./addons/${f}`);
|
||||
|
||||
console.info(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[36m`, `#${i + 1} Addon Loaded: ${props.name.toProperCase()}`);
|
||||
bot.commands.set(props.name, props);
|
||||
});
|
||||
|
||||
console.info(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[36m`, `Loaded ${jsfiles.length} addons!`);
|
||||
console.log(`\u001b[31m`, `――――――――――――――――――――――――――――――――――――――――――――`)
|
||||
console.log(` `)
|
||||
});
|
||||
|
||||
bot.login(supportbot.Token);
|
||||
client.start(supportbot.Token);
|
||||
@@ -1,8 +0,0 @@
|
||||
SupportBot Language Compatibility
|
||||
|
||||
In order to switch languages simple remove the current existig configuration file and replace it with one of the files here renamnig the file to "supportbot-config.yml" from (for example) "supportbot-config_es.yml" to home directory of SupportBot.
|
||||
|
||||
-> Delete the existing supportbot-config.yml file
|
||||
-> Download the new file for whatever language
|
||||
-> Upload the file to SupportBot and rename it to supportbot-config.yml
|
||||
-> Job Done, restart the bot :wink:
|
||||
@@ -1,310 +0,0 @@
|
||||
# ___ _ ___ _
|
||||
# / __> _ _ ___ ___ ___ _ _ _| |_ | . > ___ _| |_
|
||||
# \__ \| | || . \| . \/ . \| '_> | | | . \/ . \ | |
|
||||
# <___/`___|| _/| _/\___/|_| |_| |___/\___/ |_|
|
||||
# |_| |_|
|
||||
#
|
||||
# SupportBot created by Emerald Services
|
||||
# Installed with MIT License
|
||||
#
|
||||
# Discord Support: https://emeraldsrv.dev/discord
|
||||
|
||||
SupportBot_Version: "7.1 pre-1"
|
||||
|
||||
# -------------------------
|
||||
# General Configuration
|
||||
# -------------------------
|
||||
|
||||
Token: "BOT_TOKEN_HERE"
|
||||
Prefix: "!!"
|
||||
Bot_Name: "SupportBot"
|
||||
|
||||
DeleteMessages: true
|
||||
# Should the bot delete command messages after executed?
|
||||
|
||||
# -------------------------
|
||||
# Activity Configuration
|
||||
# -------------------------
|
||||
|
||||
BotActivity: "-help | SupportBot"
|
||||
|
||||
StreamingURL: "https://www.twitch.tv/YOUR_TWITCH_NAME"
|
||||
# Set The ActivityType to "STREAMING" for a streaming status!
|
||||
|
||||
ActivityType: "PLAYING"
|
||||
# Activity status can either be PLAYING, WATCHING, LISTENING or STREAMING.
|
||||
|
||||
# -------------------------
|
||||
# Embed Configuration
|
||||
# -------------------------
|
||||
|
||||
EmbedColour: "#f74343"
|
||||
EmbedFooter: "SupportBot | The #1 Supportive Discord Bot"
|
||||
|
||||
ErrorColour: "#d12519"
|
||||
SuccessColour: "#04b545"
|
||||
WarningColour: "#fca117"
|
||||
|
||||
# -------------------------
|
||||
# Help Configuration
|
||||
# -------------------------
|
||||
|
||||
HelpMenu: true # Do not change!
|
||||
SendHelpPage: "channel" # Set to channel or dm
|
||||
|
||||
# -------------------------
|
||||
# Role Configuration
|
||||
# -------------------------
|
||||
|
||||
AutoRole: true
|
||||
AutoRole_Role: "Member"
|
||||
LockdownRole: "@everyone"
|
||||
|
||||
Staff: "Staff"
|
||||
Admin: "Admin"
|
||||
TicketBlackListRole: "Blacklisted"
|
||||
|
||||
# -------------------------
|
||||
# Tickets Configuration
|
||||
# -------------------------
|
||||
|
||||
# --- General Config ---
|
||||
# --- Start ---
|
||||
|
||||
TicketCategory: "▬▬ TICKETS ▬▬"
|
||||
TicketChannel: "ticket"
|
||||
|
||||
TicketLog: "ticket-logs"
|
||||
TranscriptLog: "transcripts"
|
||||
|
||||
TranscriptTitle: "Ticket Transcript"
|
||||
TicketBlackListMessage: "You are not allowed to open a ticket"
|
||||
|
||||
TicketSubject: "description"
|
||||
# "description" will displays the ticket reason within the channel description
|
||||
# "embed" will displays the ticket reason within the ticket embed
|
||||
|
||||
AllowTicketMentions: true
|
||||
# Set to true to allow the ticket to mention the author and the support team.
|
||||
# Set to false to dis-allow mentions within tickets.
|
||||
|
||||
# --- Panel Config ---
|
||||
# --- Start ---
|
||||
|
||||
ReactionChannel: "create-ticket"
|
||||
ReactionEmoji: "📩"
|
||||
# For cusomt emojis: <:emoji_name:EMOJI_ID>
|
||||
|
||||
ReactionTickets: true
|
||||
ReactionMessage: "React with %reaction_emoji% to create a Support Ticket!"
|
||||
|
||||
ReactionPanel_Description: true
|
||||
ReactionDescription: "Create a support ticket to contact a member of staff."
|
||||
|
||||
ReactionPanel_Thumbnail: true
|
||||
ReactionThumbnail: "https://hotemoji.com/images/dl/5/ticket-emoji-by-twitter.png"
|
||||
|
||||
ReactionPanel_Image: true
|
||||
ReactionImage: "https://wallpapercave.com/wp/wp4462546.jpg"
|
||||
|
||||
# --- Creation Config ---
|
||||
# --- Start ---
|
||||
|
||||
# Available Placeholders:
|
||||
|
||||
# %ticketusername% - User who created the ticket.
|
||||
# <@%ticketauthor%> - Tags the user who created the ticket.
|
||||
# <#%ticketid%> - Mentions the ticket channel.
|
||||
|
||||
|
||||
Ticket_Title: "Server Support | %ticketusername%"
|
||||
TicketMessage: "Hello <@%ticketauthor%>, Thank you for creating a support ticket\nPlease wait patiently whilst a member of our team reaches out to you."
|
||||
|
||||
Ticket_Thumbnail: "https://images.emojiterra.com/google/android-pie/512px/1f39f.png"
|
||||
NoTicketSubject: "No Reason Provided!"
|
||||
|
||||
TicketCreatedAlert: ":ticket: Your support ticket has been created: <#%ticketid%>"
|
||||
|
||||
AddedUser: "👍 <@%user%> has been added to this ticket"
|
||||
RemovedUser: "👍 <@%user%> has been removed from this ticket"
|
||||
|
||||
|
||||
TicketLockReaction: "🔒"
|
||||
TicketDeleteReaction: "⛔"
|
||||
|
||||
TranscriptSavedMessage: "📝 **Transcript Saved!**"
|
||||
TicketLockMessage: "❌ **Ticket Locked!**"
|
||||
TicketDeleteMessage: "⚠ **Ticket Deleting!**" # Tickets deleting after 5 seconds by default.
|
||||
TicketDeleteTime: 5000 # Time must be set in miliseconds.
|
||||
|
||||
# --- Closing Config ---
|
||||
# --- Start ---
|
||||
|
||||
ClosingTicket: ":warning: You have requested to close your support ticket."
|
||||
ClosingConfirmation_Word: "confirm"
|
||||
CloseConfirmation: true
|
||||
|
||||
# --- Departments Config ---
|
||||
# --- Start ---
|
||||
|
||||
TicketDepartments: true
|
||||
|
||||
AllowStaff: true
|
||||
# If set to true users with the "Staff" role will not be able to view tickets
|
||||
# without a valid department role set below.
|
||||
|
||||
# Set to false to allow "Staff" to see tickets whether its a department for them or not.
|
||||
|
||||
DepartmentEmoji_1: "🙋"
|
||||
DepartmentEmoji_2: "💸"
|
||||
DepartmentEmoji_3: "📗"
|
||||
# Ticket emojis, the emojis are what users will need to react with inorder to proceed furthur if departments are enabled.
|
||||
|
||||
DepartmentTitle_1: "Support"
|
||||
DepartmentTitle_2: "Billing"
|
||||
DepartmentTitle_3: "Other"
|
||||
# Ticket department title, This is the title for a ticket department to help users know what is available.
|
||||
|
||||
DepartmentRole_1: "Support"
|
||||
DepartmentRole_2: "Admin"
|
||||
DepartmentRole_3: "Support"
|
||||
# Ticket roles are the roles that will be able to gain access to tickets depending on what department has been choosen.
|
||||
|
||||
# --------------------------------
|
||||
# System Messages Configuration
|
||||
# --------------------------------
|
||||
|
||||
# Available Placeholders:
|
||||
# %guildname% - This displays the name of the discord server.
|
||||
|
||||
SystemMessages: true
|
||||
SystemMessage_EmbedFooter: false
|
||||
|
||||
SystemMessage_Channel: "system-messages"
|
||||
SystemMessage_Type: "embed"
|
||||
# There are 2 types of how you can send system messages, 'normal' or 'embed'
|
||||
|
||||
SystemMessage_Icon: "USER"
|
||||
# USER - This will display the user's icon of who joins.
|
||||
# BOT - This will display the bot's icon when a someone joins.
|
||||
|
||||
Welcome_Title: "User Joined!"
|
||||
WelcomeMessage: "Hello %member%, Welcome to %guildname%!"
|
||||
# %member% define the user who joined and %guildnamne% defines the server name.
|
||||
|
||||
Leave_Title: "User Left!"
|
||||
LeaveMessage: "Goodbye %member%, Thank you for visting %guildname%!"
|
||||
# %member% define the user who left and %guildnamne% defines the server name.
|
||||
|
||||
# -------------------------
|
||||
# Links Configuration
|
||||
# -------------------------
|
||||
|
||||
LinksTitle: "Server Links"
|
||||
|
||||
LINKS:
|
||||
"Website": "https://www.example.com"
|
||||
"Store": "https://store.example.com"
|
||||
"Discord": "https://discord.gg/example"
|
||||
# "Twitter": "https://twitter.com/example"
|
||||
# "Add More": "Just follow this format!"
|
||||
|
||||
# --------------------------
|
||||
# Suggestion Configuration
|
||||
# --------------------------
|
||||
|
||||
SuggestionChannel: "suggestions"
|
||||
SuggestionTitle: "Suggestion"
|
||||
|
||||
SuggestionStarter: "What would you like to suggest?"
|
||||
SuggestReact_1: 👍
|
||||
SuggestReact_2: 👎
|
||||
|
||||
# ----------------------------
|
||||
# Announcement Configuration
|
||||
# ----------------------------
|
||||
|
||||
AnnouncementChannel: "announcements"
|
||||
AnnouncementTitle: "Servername Announcement"
|
||||
AnnouncementIcon: "https://i.imgur.com/HbkZyB7.png"
|
||||
|
||||
AnnouncementStarter: "What would you like to announce?"
|
||||
|
||||
# --------------------------
|
||||
# Moderation Configuration
|
||||
# --------------------------
|
||||
|
||||
BanTitle: "User Banned!"
|
||||
DaysBannedFor: 7
|
||||
BanLogColour: "#D911B4"
|
||||
|
||||
KickTitle: "User Kicked!"
|
||||
KickLogColour: "#D9B111"
|
||||
|
||||
ModThumbnail: "https://i.imgur.com/l6P3DF6.png"
|
||||
ModLogChannel: "mod-logs"
|
||||
|
||||
PruneLogTitle: "Bulk Delete"
|
||||
PruneThumbnail: "https://i.imgur.com/OAgW2vR.png"
|
||||
PruneColour: "#1BA30C"
|
||||
|
||||
BlacklistTitle: "Blacklisted User"
|
||||
BlacklistColour: "#000000"
|
||||
|
||||
# --------------------------
|
||||
# Command Configuration
|
||||
# --------------------------
|
||||
|
||||
# --- User Commands ---
|
||||
|
||||
HelpCommand: "help"
|
||||
LinksCommand: "links"
|
||||
PingCommand: "ping"
|
||||
SuggestCommand: "suggest"
|
||||
|
||||
# --- Ticket Commands ---
|
||||
|
||||
NewTicket: "ticket"
|
||||
CloseTicket: "close"
|
||||
AddUser: "add"
|
||||
RemoveUser: "remove"
|
||||
RenameTicket: "rename"
|
||||
|
||||
# --- Staff/Admin Commands ---
|
||||
|
||||
BotSay: "say"
|
||||
PurgeMessage: "purge"
|
||||
|
||||
AnnounceCommand: "announce"
|
||||
BanUser: "ban"
|
||||
KickUser: "kick"
|
||||
BlacklistUser: "blacklist"
|
||||
|
||||
# --------------------------
|
||||
# Messages Configuration
|
||||
# --------------------------
|
||||
|
||||
# --- Command Messages ---
|
||||
|
||||
NewTicketDesc: "Create a new support ticket"
|
||||
AnnounceDesc: "Create a server announcement"
|
||||
CloseTicketDesc: "Close your support ticket"
|
||||
LinksDesc: "View some important links"
|
||||
PingDesc: "Get the bot's latency"
|
||||
HelpDesc: "Get a list of all the commands"
|
||||
RemoveUserDesc: "Remove a user from a support ticket"
|
||||
AddUserDesc: "Add a user to a support ticket"
|
||||
SuggestionDesc: "Create a server suggestion"
|
||||
BotSayDesc: "Say something with the bot"
|
||||
BanDesc: "Ban a member from this server."
|
||||
KickDesc: "Kick a member from this server."
|
||||
PurgeDesc: "Purge messages from the chat."
|
||||
BlacklistDesc: "Decline a member to open a ticket"
|
||||
|
||||
# Error / Warning Messages
|
||||
|
||||
IncorrectPerms: ":x: **Err!** You do not have the correct permissions to use this command."
|
||||
InvalidChannel: ":x: **Err!** Channel not found. Please create it!"
|
||||
UserNotFound: ":x: **Err!** This user doesn't exist, Are they in this server?"
|
||||
NoValidTicket: ":warning: You cannot execute this command here. This command is used when closing a ticket."
|
||||
TicketExists: ":warning: This ticket cannot be opened, It already exists!"
|
||||
-1
@@ -1 +0,0 @@
|
||||
../acorn/bin/acorn
|
||||
-1
@@ -1 +0,0 @@
|
||||
../escodegen/bin/escodegen.js
|
||||
-1
@@ -1 +0,0 @@
|
||||
../escodegen/bin/esgenerate.js
|
||||
-1
@@ -1 +0,0 @@
|
||||
../esprima/bin/esparse.js
|
||||
-1
@@ -1 +0,0 @@
|
||||
../esprima/bin/esvalidate.js
|
||||
-1
@@ -1 +0,0 @@
|
||||
../js-yaml/bin/js-yaml.js
|
||||
-889
@@ -1,889 +0,0 @@
|
||||
{
|
||||
"name": "supportbot",
|
||||
"version": "7.1",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"node_modules/@discordjs/builders": {
|
||||
"version": "0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.5.0.tgz",
|
||||
"integrity": "sha512-HP5y4Rqw68o61Qv4qM5tVmDbWi4mdTFftqIOGRo33SNPpLJ1Ga3KEIR2ibKofkmsoQhEpLmopD1AZDs3cKpHuw==",
|
||||
"dependencies": {
|
||||
"@sindresorhus/is": "^4.0.1",
|
||||
"discord-api-types": "^0.22.0",
|
||||
"ow": "^0.27.0",
|
||||
"ts-mixer": "^6.0.0",
|
||||
"tslib": "^2.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0",
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@discordjs/builders/node_modules/discord-api-types": {
|
||||
"version": "0.22.0",
|
||||
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.22.0.tgz",
|
||||
"integrity": "sha512-l8yD/2zRbZItUQpy7ZxBJwaLX/Bs2TGaCthRppk8Sw24LOIWg12t9JEreezPoYD0SQcC2htNNo27kYEpYW/Srg==",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@discordjs/collection": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.2.1.tgz",
|
||||
"integrity": "sha512-vhxqzzM8gkomw0TYRF3tgx7SwElzUlXT/Aa41O7mOcyN6wIJfj5JmDWaO5XGKsGSsNx7F3i5oIlrucCCWV1Nog==",
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@discordjs/form-data": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/form-data/-/form-data-3.0.1.tgz",
|
||||
"integrity": "sha512-ZfFsbgEXW71Rw/6EtBdrP5VxBJy4dthyC0tpQKGKmYFImlmmrykO14Za+BiIVduwjte0jXEBlhSKf0MWbFp9Eg==",
|
||||
"dependencies": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.8",
|
||||
"mime-types": "^2.1.12"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/@discordjs/rest": {
|
||||
"version": "0.1.0-canary.0",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-0.1.0-canary.0.tgz",
|
||||
"integrity": "sha512-d+s//ISYVV+e0w/926wMEeO7vju+Pn11x1JM4tcmVMCHSDgpi6pnFCNAXF1TEdnDcy7xf9tq5cf2pQkb/7ySTQ==",
|
||||
"dependencies": {
|
||||
"@discordjs/collection": "^0.1.6",
|
||||
"@sapphire/async-queue": "^1.1.4",
|
||||
"@sapphire/snowflake": "^1.3.5",
|
||||
"abort-controller": "^3.0.0",
|
||||
"discord-api-types": "^0.18.1",
|
||||
"form-data": "^4.0.0",
|
||||
"node-fetch": "^2.6.1",
|
||||
"tslib": "^2.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@discordjs/rest/node_modules/@discordjs/collection": {
|
||||
"version": "0.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.1.6.tgz",
|
||||
"integrity": "sha512-utRNxnd9kSS2qhyivo9lMlt5qgAUasH2gb7BEOn6p0efFh24gjGomHzWKMAPn2hEReOPQZCJaRKoURwRotKucQ=="
|
||||
},
|
||||
"node_modules/@discordjs/rest/node_modules/discord-api-types": {
|
||||
"version": "0.18.1",
|
||||
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.18.1.tgz",
|
||||
"integrity": "sha512-hNC38R9ZF4uaujaZQtQfm5CdQO58uhdkoHQAVvMfIL0LgOSZeW575W8H6upngQOuoxWd8tiRII3LLJm9zuQKYg==",
|
||||
"deprecated": "No longer supported. Install the latest release (0.20.2)",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@discordjs/rest/node_modules/form-data": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
|
||||
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
|
||||
"dependencies": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.8",
|
||||
"mime-types": "^2.1.12"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/@sapphire/async-queue": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.1.4.tgz",
|
||||
"integrity": "sha512-fFrlF/uWpGOX5djw5Mu2Hnnrunao75WGey0sP0J3jnhmrJ5TAPzHYOmytD5iN/+pMxS+f+u/gezqHa9tPhRHEA==",
|
||||
"engines": {
|
||||
"node": ">=14",
|
||||
"npm": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/@sapphire/snowflake": {
|
||||
"version": "1.3.6",
|
||||
"resolved": "https://registry.npmjs.org/@sapphire/snowflake/-/snowflake-1.3.6.tgz",
|
||||
"integrity": "sha512-QnzuLp+p9D7agynVub/zqlDVriDza9y3STArBhNiNBUgIX8+GL5FpQxstRfw1jDr5jkZUjcuKYAHxjIuXKdJAg==",
|
||||
"deprecated": "This version has been automatically deprecated by @favware/npm-deprecate. Please use a newer version.",
|
||||
"engines": {
|
||||
"node": ">=12",
|
||||
"npm": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/@sindresorhus/is": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.0.1.tgz",
|
||||
"integrity": "sha512-Qm9hBEBu18wt1PO2flE7LPb30BHMQt1eQgbV76YntdNk73XZGpn3izvGTYxbGgzXKgbCjiia0uxTd3aTNQrY/g==",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sindresorhus/is?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/@tootallnate/once": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz",
|
||||
"integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==",
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "16.7.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.7.1.tgz",
|
||||
"integrity": "sha512-ncRdc45SoYJ2H4eWU9ReDfp3vtFqDYhjOsKlFFUDEn8V1Bgr2RjYal8YT5byfadWIRluhPFU6JiDOl0H6Sl87A=="
|
||||
},
|
||||
"node_modules/@types/ws": {
|
||||
"version": "7.4.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz",
|
||||
"integrity": "sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==",
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/abab": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/abab/-/abab-2.0.5.tgz",
|
||||
"integrity": "sha512-9IK9EadsbHo6jLWIpxpR6pL0sazTXV6+SQv25ZB+F7Bj9mJNaOc4nCRabwd5M/JwmUa8idz6Eci6eKfJryPs6Q=="
|
||||
},
|
||||
"node_modules/abort-controller": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
|
||||
"integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
|
||||
"dependencies": {
|
||||
"event-target-shim": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.5"
|
||||
}
|
||||
},
|
||||
"node_modules/acorn": {
|
||||
"version": "8.4.1",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.4.1.tgz",
|
||||
"integrity": "sha512-asabaBSkEKosYKMITunzX177CXxQ4Q8BSSzMTKD+FefUhipQC70gfW5SiUDhYQ3vk8G+81HqQk7Fv9OXwwn9KA==",
|
||||
"bin": {
|
||||
"acorn": "bin/acorn"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/acorn-globals": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-6.0.0.tgz",
|
||||
"integrity": "sha512-ZQl7LOWaF5ePqqcX4hLuv/bLXYQNfNWw2c0/yX/TsPRKamzHcTGQnlCjHT3TsmkOUVEPS3crCxiPfdzE/Trlhg==",
|
||||
"dependencies": {
|
||||
"acorn": "^7.1.1",
|
||||
"acorn-walk": "^7.1.1"
|
||||
}
|
||||
},
|
||||
"node_modules/acorn-globals/node_modules/acorn": {
|
||||
"version": "7.4.1",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz",
|
||||
"integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==",
|
||||
"bin": {
|
||||
"acorn": "bin/acorn"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/acorn-walk": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.2.0.tgz",
|
||||
"integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==",
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/agent-base": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
|
||||
"integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==",
|
||||
"dependencies": {
|
||||
"debug": "4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/argparse": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
|
||||
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="
|
||||
},
|
||||
"node_modules/asynckit": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
|
||||
},
|
||||
"node_modules/browser-process-hrtime": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz",
|
||||
"integrity": "sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow=="
|
||||
},
|
||||
"node_modules/callsites": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
|
||||
"integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/combined-stream": {
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
||||
"dependencies": {
|
||||
"delayed-stream": "~1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/cssom": {
|
||||
"version": "0.4.4",
|
||||
"resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz",
|
||||
"integrity": "sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw=="
|
||||
},
|
||||
"node_modules/cssstyle": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz",
|
||||
"integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==",
|
||||
"dependencies": {
|
||||
"cssom": "~0.3.6"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/cssstyle/node_modules/cssom": {
|
||||
"version": "0.3.8",
|
||||
"resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz",
|
||||
"integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg=="
|
||||
},
|
||||
"node_modules/data-urls": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/data-urls/-/data-urls-2.0.0.tgz",
|
||||
"integrity": "sha512-X5eWTSXO/BJmpdIKCRuKUgSCgAN0OwliVK3yPKbwIWU1Tdw5BRajxlzMidvh+gwko9AfQ9zIj52pzF91Q3YAvQ==",
|
||||
"dependencies": {
|
||||
"abab": "^2.0.3",
|
||||
"whatwg-mimetype": "^2.3.0",
|
||||
"whatwg-url": "^8.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "4.3.2",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz",
|
||||
"integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==",
|
||||
"dependencies": {
|
||||
"ms": "2.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"supports-color": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/decimal.js": {
|
||||
"version": "10.3.1",
|
||||
"resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.3.1.tgz",
|
||||
"integrity": "sha512-V0pfhfr8suzyPGOx3nmq4aHqabehUZn6Ch9kyFpV79TGDTWFmHqUqXdabR7QHqxzrYolF4+tVmJhUG4OURg5dQ=="
|
||||
},
|
||||
"node_modules/deep-is": {
|
||||
"version": "0.1.3",
|
||||
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz",
|
||||
"integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ="
|
||||
},
|
||||
"node_modules/delayed-stream": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=",
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/discord-api-types": {
|
||||
"version": "0.23.1",
|
||||
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.23.1.tgz",
|
||||
"integrity": "sha512-igWmn+45mzXRWNEPU25I/pr8MwxHb767wAr51oy3VRLRcTlp5ADBbrBR0lq3SA1Rfw3MtM4TQu1xo3kxscfVdQ==",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/discord.js": {
|
||||
"version": "13.1.0",
|
||||
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.1.0.tgz",
|
||||
"integrity": "sha512-gxO4CXKdHpqA+WKG+f5RNnd3srTDj5uFJHgOathksDE90YNq/Qijkd2WlMgTTMS6AJoEnHxI7G9eDQHCuZ+xDA==",
|
||||
"dependencies": {
|
||||
"@discordjs/builders": "^0.5.0",
|
||||
"@discordjs/collection": "^0.2.1",
|
||||
"@discordjs/form-data": "^3.0.1",
|
||||
"@sapphire/async-queue": "^1.1.4",
|
||||
"@types/ws": "^7.4.7",
|
||||
"discord-api-types": "^0.22.0",
|
||||
"node-fetch": "^2.6.1",
|
||||
"ws": "^7.5.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.6.0",
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/discord.js/node_modules/discord-api-types": {
|
||||
"version": "0.22.0",
|
||||
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.22.0.tgz",
|
||||
"integrity": "sha512-l8yD/2zRbZItUQpy7ZxBJwaLX/Bs2TGaCthRppk8Sw24LOIWg12t9JEreezPoYD0SQcC2htNNo27kYEpYW/Srg==",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/domexception": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/domexception/-/domexception-2.0.1.tgz",
|
||||
"integrity": "sha512-yxJ2mFy/sibVQlu5qHjOkf9J3K6zgmCxgJ94u2EdvDOV09H+32LtRswEcUsmUWN72pVLOEnTSRaIVVzVQgS0dg==",
|
||||
"dependencies": {
|
||||
"webidl-conversions": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/domexception/node_modules/webidl-conversions": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-5.0.0.tgz",
|
||||
"integrity": "sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA==",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/dot-prop": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-6.0.1.tgz",
|
||||
"integrity": "sha512-tE7ztYzXHIeyvc7N+hR3oi7FIbf/NIjVP9hmAt3yMXzrQ072/fpjGLx2GxNxGxUl5V73MEqYzioOMoVhGMJ5cA==",
|
||||
"dependencies": {
|
||||
"is-obj": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/escodegen": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.0.0.tgz",
|
||||
"integrity": "sha512-mmHKys/C8BFUGI+MAWNcSYoORYLMdPzjrknd2Vc+bUsjN5bXcr8EhrNB+UTqfL1y3I9c4fw2ihgtMPQLBRiQxw==",
|
||||
"dependencies": {
|
||||
"esprima": "^4.0.1",
|
||||
"estraverse": "^5.2.0",
|
||||
"esutils": "^2.0.2",
|
||||
"optionator": "^0.8.1"
|
||||
},
|
||||
"bin": {
|
||||
"escodegen": "bin/escodegen.js",
|
||||
"esgenerate": "bin/esgenerate.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"source-map": "~0.6.1"
|
||||
}
|
||||
},
|
||||
"node_modules/esprima": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
|
||||
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
|
||||
"bin": {
|
||||
"esparse": "bin/esparse.js",
|
||||
"esvalidate": "bin/esvalidate.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/estraverse": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz",
|
||||
"integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==",
|
||||
"engines": {
|
||||
"node": ">=4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/esutils": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
|
||||
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/event-target-shim": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
|
||||
"integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/fast-levenshtein": {
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
|
||||
"integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc="
|
||||
},
|
||||
"node_modules/form-data": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz",
|
||||
"integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==",
|
||||
"dependencies": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.8",
|
||||
"mime-types": "^2.1.12"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/html-encoding-sniffer": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-2.0.1.tgz",
|
||||
"integrity": "sha512-D5JbOMBIR/TVZkubHT+OyT2705QvogUW4IBn6nHd756OwieSF9aDYFj4dv6HHEVGYbHaLETa3WggZYWWMyy3ZQ==",
|
||||
"dependencies": {
|
||||
"whatwg-encoding": "^1.0.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/http-proxy-agent": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz",
|
||||
"integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==",
|
||||
"dependencies": {
|
||||
"@tootallnate/once": "1",
|
||||
"agent-base": "6",
|
||||
"debug": "4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/https-proxy-agent": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz",
|
||||
"integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==",
|
||||
"dependencies": {
|
||||
"agent-base": "6",
|
||||
"debug": "4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/iconv-lite": {
|
||||
"version": "0.4.24",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
|
||||
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
|
||||
"dependencies": {
|
||||
"safer-buffer": ">= 2.1.2 < 3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/is-obj": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz",
|
||||
"integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/is-potential-custom-element-name": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz",
|
||||
"integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ=="
|
||||
},
|
||||
"node_modules/js-yaml": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
|
||||
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
|
||||
"dependencies": {
|
||||
"argparse": "^2.0.1"
|
||||
},
|
||||
"bin": {
|
||||
"js-yaml": "bin/js-yaml.js"
|
||||
}
|
||||
},
|
||||
"node_modules/jsdom": {
|
||||
"version": "16.7.0",
|
||||
"resolved": "https://registry.npmjs.org/jsdom/-/jsdom-16.7.0.tgz",
|
||||
"integrity": "sha512-u9Smc2G1USStM+s/x1ru5Sxrl6mPYCbByG1U/hUmqaVsm4tbNyS7CicOSRyuGQYZhTu0h84qkZZQ/I+dzizSVw==",
|
||||
"dependencies": {
|
||||
"abab": "^2.0.5",
|
||||
"acorn": "^8.2.4",
|
||||
"acorn-globals": "^6.0.0",
|
||||
"cssom": "^0.4.4",
|
||||
"cssstyle": "^2.3.0",
|
||||
"data-urls": "^2.0.0",
|
||||
"decimal.js": "^10.2.1",
|
||||
"domexception": "^2.0.1",
|
||||
"escodegen": "^2.0.0",
|
||||
"form-data": "^3.0.0",
|
||||
"html-encoding-sniffer": "^2.0.1",
|
||||
"http-proxy-agent": "^4.0.1",
|
||||
"https-proxy-agent": "^5.0.0",
|
||||
"is-potential-custom-element-name": "^1.0.1",
|
||||
"nwsapi": "^2.2.0",
|
||||
"parse5": "6.0.1",
|
||||
"saxes": "^5.0.1",
|
||||
"symbol-tree": "^3.2.4",
|
||||
"tough-cookie": "^4.0.0",
|
||||
"w3c-hr-time": "^1.0.2",
|
||||
"w3c-xmlserializer": "^2.0.0",
|
||||
"webidl-conversions": "^6.1.0",
|
||||
"whatwg-encoding": "^1.0.5",
|
||||
"whatwg-mimetype": "^2.3.0",
|
||||
"whatwg-url": "^8.5.0",
|
||||
"ws": "^7.4.6",
|
||||
"xml-name-validator": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"canvas": "^2.5.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"canvas": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/levn": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz",
|
||||
"integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=",
|
||||
"dependencies": {
|
||||
"prelude-ls": "~1.1.2",
|
||||
"type-check": "~0.3.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/lodash": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
|
||||
},
|
||||
"node_modules/lodash.isequal": {
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz",
|
||||
"integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA="
|
||||
},
|
||||
"node_modules/mime-db": {
|
||||
"version": "1.48.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.48.0.tgz",
|
||||
"integrity": "sha512-FM3QwxV+TnZYQ2aRqhlKBMHxk10lTbMt3bBkMAp54ddrNeVSfcQYOOKuGuy3Ddrm38I04If834fOUSq1yzslJQ==",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-types": {
|
||||
"version": "2.1.31",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.31.tgz",
|
||||
"integrity": "sha512-XGZnNzm3QvgKxa8dpzyhFTHmpP3l5YNusmne07VUOXxou9CqUqYa/HBy124RqtVh/O2pECas/MOcsDgpilPOPg==",
|
||||
"dependencies": {
|
||||
"mime-db": "1.48.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||
},
|
||||
"node_modules/node-fetch": {
|
||||
"version": "2.6.1",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
|
||||
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==",
|
||||
"engines": {
|
||||
"node": "4.x || >=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/nwsapi": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.0.tgz",
|
||||
"integrity": "sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ=="
|
||||
},
|
||||
"node_modules/optionator": {
|
||||
"version": "0.8.3",
|
||||
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz",
|
||||
"integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==",
|
||||
"dependencies": {
|
||||
"deep-is": "~0.1.3",
|
||||
"fast-levenshtein": "~2.0.6",
|
||||
"levn": "~0.3.0",
|
||||
"prelude-ls": "~1.1.2",
|
||||
"type-check": "~0.3.2",
|
||||
"word-wrap": "~1.2.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ow": {
|
||||
"version": "0.27.0",
|
||||
"resolved": "https://registry.npmjs.org/ow/-/ow-0.27.0.tgz",
|
||||
"integrity": "sha512-SGnrGUbhn4VaUGdU0EJLMwZWSupPmF46hnTRII7aCLCrqixTAC5eKo8kI4/XXf1eaaI8YEVT+3FeGNJI9himAQ==",
|
||||
"dependencies": {
|
||||
"@sindresorhus/is": "^4.0.1",
|
||||
"callsites": "^3.1.0",
|
||||
"dot-prop": "^6.0.1",
|
||||
"lodash.isequal": "^4.5.0",
|
||||
"type-fest": "^1.2.1",
|
||||
"vali-date": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/parse5": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz",
|
||||
"integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw=="
|
||||
},
|
||||
"node_modules/prelude-ls": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz",
|
||||
"integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=",
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/psl": {
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz",
|
||||
"integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ=="
|
||||
},
|
||||
"node_modules/punycode": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
|
||||
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||
},
|
||||
"node_modules/saxes": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/saxes/-/saxes-5.0.1.tgz",
|
||||
"integrity": "sha512-5LBh1Tls8c9xgGjw3QrMwETmTMVk0oFgvrFSvWx62llR2hcEInrKNZ2GZCCuuy2lvWrdl5jhbpeqc5hRYKFOcw==",
|
||||
"dependencies": {
|
||||
"xmlchars": "^2.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/source-map": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/symbol-tree": {
|
||||
"version": "3.2.4",
|
||||
"resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz",
|
||||
"integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw=="
|
||||
},
|
||||
"node_modules/tough-cookie": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.0.0.tgz",
|
||||
"integrity": "sha512-tHdtEpQCMrc1YLrMaqXXcj6AxhYi/xgit6mZu1+EDWUn+qhUf8wMQoFIy9NXuq23zAwtcB0t/MjACGR18pcRbg==",
|
||||
"dependencies": {
|
||||
"psl": "^1.1.33",
|
||||
"punycode": "^2.1.1",
|
||||
"universalify": "^0.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/tr46": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-2.1.0.tgz",
|
||||
"integrity": "sha512-15Ih7phfcdP5YxqiB+iDtLoaTz4Nd35+IiAv0kQ5FNKHzXgdWqPoTIqEDDJmXceQt4JZk6lVPT8lnDlPpGDppw==",
|
||||
"dependencies": {
|
||||
"punycode": "^2.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/ts-mixer": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.0.tgz",
|
||||
"integrity": "sha512-nXIb1fvdY5CBSrDIblLn73NW0qRDk5yJ0Sk1qPBF560OdJfQp9jhl+0tzcY09OZ9U+6GpeoI9RjwoIKFIoB9MQ=="
|
||||
},
|
||||
"node_modules/tslib": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz",
|
||||
"integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
|
||||
},
|
||||
"node_modules/type-check": {
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz",
|
||||
"integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=",
|
||||
"dependencies": {
|
||||
"prelude-ls": "~1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/type-fest": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz",
|
||||
"integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/universalify": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
|
||||
"integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",
|
||||
"engines": {
|
||||
"node": ">= 4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/vali-date": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/vali-date/-/vali-date-1.0.0.tgz",
|
||||
"integrity": "sha1-G5BKWWCfsyjvB4E4Qgk09rhnCaY=",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/w3c-hr-time": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz",
|
||||
"integrity": "sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==",
|
||||
"dependencies": {
|
||||
"browser-process-hrtime": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/w3c-xmlserializer": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-2.0.0.tgz",
|
||||
"integrity": "sha512-4tzD0mF8iSiMiNs30BiLO3EpfGLZUT2MSX/G+o7ZywDzliWQ3OPtTZ0PTC3B3ca1UAf4cJMHB+2Bf56EriJuRA==",
|
||||
"dependencies": {
|
||||
"xml-name-validator": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/webidl-conversions": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-6.1.0.tgz",
|
||||
"integrity": "sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w==",
|
||||
"engines": {
|
||||
"node": ">=10.4"
|
||||
}
|
||||
},
|
||||
"node_modules/whatwg-encoding": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz",
|
||||
"integrity": "sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw==",
|
||||
"dependencies": {
|
||||
"iconv-lite": "0.4.24"
|
||||
}
|
||||
},
|
||||
"node_modules/whatwg-mimetype": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz",
|
||||
"integrity": "sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g=="
|
||||
},
|
||||
"node_modules/whatwg-url": {
|
||||
"version": "8.7.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-8.7.0.tgz",
|
||||
"integrity": "sha512-gAojqb/m9Q8a5IV96E3fHJM70AzCkgt4uXYX2O7EmuyOnLrViCQlsEBmF9UQIu3/aeAIp2U17rtbpZWNntQqdg==",
|
||||
"dependencies": {
|
||||
"lodash": "^4.7.0",
|
||||
"tr46": "^2.1.0",
|
||||
"webidl-conversions": "^6.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/word-wrap": {
|
||||
"version": "1.2.3",
|
||||
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
|
||||
"integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ws": {
|
||||
"version": "7.5.1",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.1.tgz",
|
||||
"integrity": "sha512-2c6faOUH/nhoQN6abwMloF7Iyl0ZS2E9HGtsiLrWn0zOOMWlhtDmdf/uihDt6jnuCxgtwGBNy6Onsoy2s2O2Ow==",
|
||||
"engines": {
|
||||
"node": ">=8.3.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"bufferutil": "^4.0.1",
|
||||
"utf-8-validate": "^5.0.2"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"bufferutil": {
|
||||
"optional": true
|
||||
},
|
||||
"utf-8-validate": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/xml-name-validator": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz",
|
||||
"integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw=="
|
||||
},
|
||||
"node_modules/xmlchars": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz",
|
||||
"integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw=="
|
||||
}
|
||||
}
|
||||
}
|
||||
-190
@@ -1,190 +0,0 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Copyright 2021 Vlad Frangu
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
<div align="center">
|
||||
<br />
|
||||
<p>
|
||||
<a href="https://discord.js.org"><img src="https://discord.js.org/static/logo.svg" width="546" alt="discord.js" /></a>
|
||||
</p>
|
||||
<br />
|
||||
<p>
|
||||
<a href="https://discord.gg/djs"><img src="https://img.shields.io/discord/222078108977594368?color=5865F2&logo=discord&logoColor=white" alt="Discord server" /></a>
|
||||
<a href="https://github.com/discordjs/builders/actions"><img src="https://github.com/discordjs/builders/workflows/Tests/badge.svg" alt="Test status" /></a>
|
||||
<a href="https://github.com/discordjs/builders/actions"><img src="https://github.com/discordjs/builders/workflows/Lint/badge.svg" alt="Lint status" /></a>
|
||||
<a href="https://codecov.io/gh/discordjs/builders"><img src="https://codecov.io/gh/discordjs/builders/branch/main/graph/badge.svg" alt="Code coverage" /></a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
## Installation
|
||||
|
||||
Install with [npm](https://www.npmjs.com/) / [yarn](https://yarnpkg.com) / [pnpm](https://pnpm.js.org/):
|
||||
|
||||
```sh
|
||||
npm install @discordjs/builders
|
||||
yarn add @discordjs/builders
|
||||
pnpm add @discordjs/builders
|
||||
```
|
||||
|
||||
## Contribution
|
||||
|
||||
See [Contributing Guide](https://github.com/discordjs/builders/blob/main/.github/CONTRIBUTING.md).
|
||||
|
||||
## Examples
|
||||
|
||||
Here are some examples for the builders and utilities you can find in this package:
|
||||
|
||||
- [Slash Command Builders](./docs/examples/Slash%20Command%20Builders.md)
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
export * from './messages/formatters';
|
||||
export * as SlashCommandAssertions from './interactions/slashCommands/Assertions';
|
||||
export * from './interactions/slashCommands/SlashCommandBuilder';
|
||||
export * from './interactions/slashCommands/SlashCommandSubcommands';
|
||||
export * from './interactions/slashCommands/options/boolean';
|
||||
export * from './interactions/slashCommands/options/channel';
|
||||
export * from './interactions/slashCommands/options/integer';
|
||||
export * from './interactions/slashCommands/options/mentionable';
|
||||
export * from './interactions/slashCommands/options/role';
|
||||
export * from './interactions/slashCommands/options/string';
|
||||
export * from './interactions/slashCommands/options/user';
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AAEtC,OAAO,KAAK,sBAAsB,MAAM,yCAAyC,CAAC;AAClF,cAAc,kDAAkD,CAAC;AACjE,cAAc,sDAAsD,CAAC;AACrE,cAAc,8CAA8C,CAAC;AAC7D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,kDAAkD,CAAC;AACjE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,2CAA2C,CAAC"}
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SlashCommandAssertions = void 0;
|
||||
const tslib_1 = require("tslib");
|
||||
tslib_1.__exportStar(require("./messages/formatters"), exports);
|
||||
exports.SlashCommandAssertions = tslib_1.__importStar(require("./interactions/slashCommands/Assertions"));
|
||||
tslib_1.__exportStar(require("./interactions/slashCommands/SlashCommandBuilder"), exports);
|
||||
tslib_1.__exportStar(require("./interactions/slashCommands/SlashCommandSubcommands"), exports);
|
||||
tslib_1.__exportStar(require("./interactions/slashCommands/options/boolean"), exports);
|
||||
tslib_1.__exportStar(require("./interactions/slashCommands/options/channel"), exports);
|
||||
tslib_1.__exportStar(require("./interactions/slashCommands/options/integer"), exports);
|
||||
tslib_1.__exportStar(require("./interactions/slashCommands/options/mentionable"), exports);
|
||||
tslib_1.__exportStar(require("./interactions/slashCommands/options/role"), exports);
|
||||
tslib_1.__exportStar(require("./interactions/slashCommands/options/string"), exports);
|
||||
tslib_1.__exportStar(require("./interactions/slashCommands/options/user"), exports);
|
||||
//# sourceMappingURL=index.js.map
|
||||
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;AAAA,gEAAsC;AAEtC,0GAAkF;AAClF,2FAAiE;AACjE,+FAAqE;AACrE,uFAA6D;AAC7D,uFAA6D;AAC7D,uFAA6D;AAC7D,2FAAiE;AACjE,oFAA0D;AAC1D,sFAA4D;AAC5D,oFAA0D","sourcesContent":["export * from './messages/formatters';\n\nexport * as SlashCommandAssertions from './interactions/slashCommands/Assertions';\nexport * from './interactions/slashCommands/SlashCommandBuilder';\nexport * from './interactions/slashCommands/SlashCommandSubcommands';\nexport * from './interactions/slashCommands/options/boolean';\nexport * from './interactions/slashCommands/options/channel';\nexport * from './interactions/slashCommands/options/integer';\nexport * from './interactions/slashCommands/options/mentionable';\nexport * from './interactions/slashCommands/options/role';\nexport * from './interactions/slashCommands/options/string';\nexport * from './interactions/slashCommands/options/user';\n"]}
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
import mod from "./index.js";
|
||||
|
||||
export default mod;
|
||||
export const Faces = mod.Faces;
|
||||
export const SlashCommandAssertions = mod.SlashCommandAssertions;
|
||||
export const SlashCommandBooleanOption = mod.SlashCommandBooleanOption;
|
||||
export const SlashCommandBuilder = mod.SlashCommandBuilder;
|
||||
export const SlashCommandChannelOption = mod.SlashCommandChannelOption;
|
||||
export const SlashCommandIntegerOption = mod.SlashCommandIntegerOption;
|
||||
export const SlashCommandMentionableOption = mod.SlashCommandMentionableOption;
|
||||
export const SlashCommandRoleOption = mod.SlashCommandRoleOption;
|
||||
export const SlashCommandStringOption = mod.SlashCommandStringOption;
|
||||
export const SlashCommandSubcommandBuilder = mod.SlashCommandSubcommandBuilder;
|
||||
export const SlashCommandSubcommandGroupBuilder = mod.SlashCommandSubcommandGroupBuilder;
|
||||
export const SlashCommandUserOption = mod.SlashCommandUserOption;
|
||||
export const TimestampStyles = mod.TimestampStyles;
|
||||
export const blockQuote = mod.blockQuote;
|
||||
export const bold = mod.bold;
|
||||
export const channelMention = mod.channelMention;
|
||||
export const codeBlock = mod.codeBlock;
|
||||
export const formatEmoji = mod.formatEmoji;
|
||||
export const hideLinkEmbed = mod.hideLinkEmbed;
|
||||
export const hyperlink = mod.hyperlink;
|
||||
export const inlineCode = mod.inlineCode;
|
||||
export const italic = mod.italic;
|
||||
export const memberNicknameMention = mod.memberNicknameMention;
|
||||
export const quote = mod.quote;
|
||||
export const roleMention = mod.roleMention;
|
||||
export const spoiler = mod.spoiler;
|
||||
export const strikethrough = mod.strikethrough;
|
||||
export const time = mod.time;
|
||||
export const underscore = mod.underscore;
|
||||
export const userMention = mod.userMention;
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
import type { APIApplicationCommandOptionChoice } from 'discord-api-types/v9';
|
||||
import type { SlashCommandOptionBase } from './mixins/CommandOptionBase';
|
||||
import type { ToAPIApplicationCommandOptions } from './SlashCommandBuilder';
|
||||
import type { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder } from './SlashCommandSubcommands';
|
||||
export declare function validateRequiredParameters(name: string, description: string, options: ToAPIApplicationCommandOptions[]): void;
|
||||
export declare function validateName(name: unknown): asserts name is string;
|
||||
export declare function validateDescription(description: unknown): asserts description is string;
|
||||
export declare function validateMaxOptionsLength(options: unknown): asserts options is ToAPIApplicationCommandOptions[];
|
||||
export declare function validateMaxChoicesLength(choices: APIApplicationCommandOptionChoice[]): void;
|
||||
export declare function assertReturnOfBuilder<T extends SlashCommandOptionBase | SlashCommandSubcommandBuilder | SlashCommandSubcommandGroupBuilder>(input: unknown, ExpectedInstanceOf: new () => T): asserts input is T;
|
||||
//# sourceMappingURL=Assertions.d.ts.map
|
||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"Assertions.d.ts","sourceRoot":"/","sources":["interactions/slashCommands/Assertions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,sBAAsB,CAAC;AAE9E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,KAAK,EAAE,6BAA6B,EAAE,kCAAkC,EAAE,MAAM,2BAA2B,CAAC;AAEnH,wBAAgB,0BAA0B,CACzC,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,8BAA8B,EAAE,QAUzC;AAUD,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,IAAI,MAAM,CAElE;AAID,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,IAAI,MAAM,CAEvF;AAID,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,8BAA8B,EAAE,CAE9G;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,iCAAiC,EAAE,QAEpF;AAED,wBAAgB,qBAAqB,CACpC,CAAC,SAAS,sBAAsB,GAAG,6BAA6B,GAAG,kCAAkC,EACpG,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,UAAU,CAAC,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,CAuBrE"}
|
||||
-58
@@ -1,58 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.assertReturnOfBuilder = exports.validateMaxChoicesLength = exports.validateMaxOptionsLength = exports.validateDescription = exports.validateName = exports.validateRequiredParameters = void 0;
|
||||
const tslib_1 = require("tslib");
|
||||
const is_1 = tslib_1.__importDefault(require("@sindresorhus/is"));
|
||||
const ow_1 = tslib_1.__importDefault(require("ow"));
|
||||
function validateRequiredParameters(name, description, options) {
|
||||
// Assert name matches all conditions
|
||||
validateName(name);
|
||||
// Assert description conditions
|
||||
validateDescription(description);
|
||||
// Assert options conditions
|
||||
validateMaxOptionsLength(options);
|
||||
}
|
||||
exports.validateRequiredParameters = validateRequiredParameters;
|
||||
const namePredicate = ow_1.default.string.lowercase
|
||||
.minLength(1)
|
||||
.maxLength(32)
|
||||
.addValidator({
|
||||
message: (value, label) => `Expected ${label} to match "^[\\p{L}\\p{N}_-]+$", got ${value} instead`,
|
||||
validator: (value) => /^[\p{L}\p{N}_-]+$/u.test(value),
|
||||
});
|
||||
function validateName(name) {
|
||||
ow_1.default(name, 'name', namePredicate);
|
||||
}
|
||||
exports.validateName = validateName;
|
||||
const descriptionPredicate = ow_1.default.string.minLength(1).maxLength(100);
|
||||
function validateDescription(description) {
|
||||
ow_1.default(description, 'description', descriptionPredicate);
|
||||
}
|
||||
exports.validateDescription = validateDescription;
|
||||
const maxArrayLengthPredicate = ow_1.default.array.maxLength(25);
|
||||
function validateMaxOptionsLength(options) {
|
||||
ow_1.default(options, 'options', maxArrayLengthPredicate);
|
||||
}
|
||||
exports.validateMaxOptionsLength = validateMaxOptionsLength;
|
||||
function validateMaxChoicesLength(choices) {
|
||||
ow_1.default(choices, 'choices', maxArrayLengthPredicate);
|
||||
}
|
||||
exports.validateMaxChoicesLength = validateMaxChoicesLength;
|
||||
function assertReturnOfBuilder(input, ExpectedInstanceOf) {
|
||||
const instanceName = ExpectedInstanceOf.name;
|
||||
if (is_1.default.nullOrUndefined(input)) {
|
||||
throw new TypeError(`Expected to receive a ${instanceName} builder, got ${input === null ? 'null' : 'undefined'} instead.`);
|
||||
}
|
||||
if (is_1.default.primitive(input)) {
|
||||
throw new TypeError(`Expected to receive a ${instanceName} builder, got a primitive (${typeof input}) instead.`);
|
||||
}
|
||||
if (!(input instanceof ExpectedInstanceOf)) {
|
||||
const casted = input;
|
||||
const constructorName = is_1.default.function_(input) ? input.name : casted.constructor.name;
|
||||
const stringTag = Reflect.get(casted, Symbol.toStringTag);
|
||||
const fullResultName = stringTag ? `${constructorName} [${stringTag}]` : constructorName;
|
||||
throw new TypeError(`Expected to receive a ${instanceName} builder, got ${fullResultName} instead.`);
|
||||
}
|
||||
}
|
||||
exports.assertReturnOfBuilder = assertReturnOfBuilder;
|
||||
//# sourceMappingURL=Assertions.js.map
|
||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"Assertions.js","sourceRoot":"/","sources":["interactions/slashCommands/Assertions.ts"],"names":[],"mappings":";;;;AAAA,kEAAkC;AAElC,oDAAoB;AAKpB,SAAgB,0BAA0B,CACzC,IAAY,EACZ,WAAmB,EACnB,OAAyC;IAEzC,qCAAqC;IACrC,YAAY,CAAC,IAAI,CAAC,CAAC;IAEnB,gCAAgC;IAChC,mBAAmB,CAAC,WAAW,CAAC,CAAC;IAEjC,4BAA4B;IAC5B,wBAAwB,CAAC,OAAO,CAAC,CAAC;AACnC,CAAC;AAbD,gEAaC;AAED,MAAM,aAAa,GAAG,YAAE,CAAC,MAAM,CAAC,SAAS;KACvC,SAAS,CAAC,CAAC,CAAC;KACZ,SAAS,CAAC,EAAE,CAAC;KACb,YAAY,CAAC;IACb,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,YAAY,KAAM,wCAAwC,KAAK,UAAU;IACpG,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC;CACtD,CAAC,CAAC;AAEJ,SAAgB,YAAY,CAAC,IAAa;IACzC,YAAE,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;AACjC,CAAC;AAFD,oCAEC;AAED,MAAM,oBAAoB,GAAG,YAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;AAEnE,SAAgB,mBAAmB,CAAC,WAAoB;IACvD,YAAE,CAAC,WAAW,EAAE,aAAa,EAAE,oBAAoB,CAAC,CAAC;AACtD,CAAC;AAFD,kDAEC;AAED,MAAM,uBAAuB,GAAG,YAAE,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;AAEvD,SAAgB,wBAAwB,CAAC,OAAgB;IACxD,YAAE,CAAC,OAAO,EAAE,SAAS,EAAE,uBAAuB,CAAC,CAAC;AACjD,CAAC;AAFD,4DAEC;AAED,SAAgB,wBAAwB,CAAC,OAA4C;IACpF,YAAE,CAAC,OAAO,EAAE,SAAS,EAAE,uBAAuB,CAAC,CAAC;AACjD,CAAC;AAFD,4DAEC;AAED,SAAgB,qBAAqB,CAEnC,KAAc,EAAE,kBAA+B;IAChD,MAAM,YAAY,GAAG,kBAAkB,CAAC,IAAI,CAAC;IAE7C,IAAI,YAAE,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE;QAC9B,MAAM,IAAI,SAAS,CAClB,yBAAyB,YAAY,iBAAiB,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,WAAW,CACtG,CAAC;KACF;IAED,IAAI,YAAE,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE;QACxB,MAAM,IAAI,SAAS,CAAC,yBAAyB,YAAY,8BAA8B,OAAO,KAAK,YAAY,CAAC,CAAC;KACjH;IAED,IAAI,CAAC,CAAC,KAAK,YAAY,kBAAkB,CAAC,EAAE;QAC3C,MAAM,MAAM,GAAG,KAAqC,CAAC;QAErD,MAAM,eAAe,GAAG,YAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC;QACnF,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,WAAW,CAAuB,CAAC;QAEhF,MAAM,cAAc,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,eAAe,KAAK,SAAS,GAAG,CAAC,CAAC,CAAC,eAAe,CAAC;QAEzF,MAAM,IAAI,SAAS,CAAC,yBAAyB,YAAY,iBAAiB,cAAc,WAAW,CAAC,CAAC;KACrG;AACF,CAAC;AAzBD,sDAyBC","sourcesContent":["import is from '@sindresorhus/is';\nimport type { APIApplicationCommandOptionChoice } from 'discord-api-types/v9';\nimport ow from 'ow';\nimport type { SlashCommandOptionBase } from './mixins/CommandOptionBase';\nimport type { ToAPIApplicationCommandOptions } from './SlashCommandBuilder';\nimport type { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder } from './SlashCommandSubcommands';\n\nexport function validateRequiredParameters(\n\tname: string,\n\tdescription: string,\n\toptions: ToAPIApplicationCommandOptions[],\n) {\n\t// Assert name matches all conditions\n\tvalidateName(name);\n\n\t// Assert description conditions\n\tvalidateDescription(description);\n\n\t// Assert options conditions\n\tvalidateMaxOptionsLength(options);\n}\n\nconst namePredicate = ow.string.lowercase\n\t.minLength(1)\n\t.maxLength(32)\n\t.addValidator({\n\t\tmessage: (value, label) => `Expected ${label!} to match \"^[\\\\p{L}\\\\p{N}_-]+$\", got ${value} instead`,\n\t\tvalidator: (value) => /^[\\p{L}\\p{N}_-]+$/u.test(value),\n\t});\n\nexport function validateName(name: unknown): asserts name is string {\n\tow(name, 'name', namePredicate);\n}\n\nconst descriptionPredicate = ow.string.minLength(1).maxLength(100);\n\nexport function validateDescription(description: unknown): asserts description is string {\n\tow(description, 'description', descriptionPredicate);\n}\n\nconst maxArrayLengthPredicate = ow.array.maxLength(25);\n\nexport function validateMaxOptionsLength(options: unknown): asserts options is ToAPIApplicationCommandOptions[] {\n\tow(options, 'options', maxArrayLengthPredicate);\n}\n\nexport function validateMaxChoicesLength(choices: APIApplicationCommandOptionChoice[]) {\n\tow(choices, 'choices', maxArrayLengthPredicate);\n}\n\nexport function assertReturnOfBuilder<\n\tT extends SlashCommandOptionBase | SlashCommandSubcommandBuilder | SlashCommandSubcommandGroupBuilder,\n>(input: unknown, ExpectedInstanceOf: new () => T): asserts input is T {\n\tconst instanceName = ExpectedInstanceOf.name;\n\n\tif (is.nullOrUndefined(input)) {\n\t\tthrow new TypeError(\n\t\t\t`Expected to receive a ${instanceName} builder, got ${input === null ? 'null' : 'undefined'} instead.`,\n\t\t);\n\t}\n\n\tif (is.primitive(input)) {\n\t\tthrow new TypeError(`Expected to receive a ${instanceName} builder, got a primitive (${typeof input}) instead.`);\n\t}\n\n\tif (!(input instanceof ExpectedInstanceOf)) {\n\t\tconst casted = input as Record<PropertyKey, unknown>;\n\n\t\tconst constructorName = is.function_(input) ? input.name : casted.constructor.name;\n\t\tconst stringTag = Reflect.get(casted, Symbol.toStringTag) as string | undefined;\n\n\t\tconst fullResultName = stringTag ? `${constructorName} [${stringTag}]` : constructorName;\n\n\t\tthrow new TypeError(`Expected to receive a ${instanceName} builder, got ${fullResultName} instead.`);\n\t}\n}\n"]}
|
||||
Generated
Vendored
-50
@@ -1,50 +0,0 @@
|
||||
import type { APIApplicationCommandOption } from 'discord-api-types/v9';
|
||||
import { SharedNameAndDescription } from './mixins/NameAndDescription';
|
||||
import { SharedSlashCommandOptions } from './mixins/CommandOptions';
|
||||
import { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder } from './SlashCommandSubcommands';
|
||||
export declare class SlashCommandBuilder {
|
||||
/**
|
||||
* The name of this slash command
|
||||
*/
|
||||
readonly name: string;
|
||||
/**
|
||||
* The description of this slash command
|
||||
*/
|
||||
readonly description: string;
|
||||
/**
|
||||
* The options of this slash command
|
||||
*/
|
||||
readonly options: ToAPIApplicationCommandOptions[];
|
||||
/**
|
||||
* Returns the final data that should be sent to Discord.
|
||||
*
|
||||
* **Note:** Calling this function will validate required properties based on their conditions.
|
||||
*/
|
||||
toJSON(): {
|
||||
name: string;
|
||||
description: string;
|
||||
options: APIApplicationCommandOption[];
|
||||
};
|
||||
/**
|
||||
* Adds a new subcommand group to this command
|
||||
* @param input A function that returns a subcommand group builder, or an already built builder
|
||||
*/
|
||||
addSubcommandGroup(input: SlashCommandSubcommandGroupBuilder | ((subcommandGroup: SlashCommandSubcommandGroupBuilder) => SlashCommandSubcommandGroupBuilder)): SlashCommandSubcommandGroupsOnlyBuilder;
|
||||
/**
|
||||
* Adds a new subcommand to this command
|
||||
* @param input A function that returns a subcommand builder, or an already built builder
|
||||
*/
|
||||
addSubcommand(input: SlashCommandSubcommandBuilder | ((subcommandGroup: SlashCommandSubcommandBuilder) => SlashCommandSubcommandBuilder)): SlashCommandSubcommandsOnlyBuilder;
|
||||
}
|
||||
export interface SlashCommandBuilder extends SharedNameAndDescription, SharedSlashCommandOptions {
|
||||
}
|
||||
export interface SlashCommandSubcommandsOnlyBuilder extends SharedNameAndDescription, Pick<SlashCommandBuilder, 'toJSON' | 'addSubcommand'> {
|
||||
}
|
||||
export interface SlashCommandSubcommandGroupsOnlyBuilder extends SharedNameAndDescription, Pick<SlashCommandBuilder, 'toJSON' | 'addSubcommandGroup'> {
|
||||
}
|
||||
export interface SlashCommandOptionsOnlyBuilder extends SharedNameAndDescription, SharedSlashCommandOptions, Pick<SlashCommandBuilder, 'toJSON'> {
|
||||
}
|
||||
export interface ToAPIApplicationCommandOptions {
|
||||
toJSON(): APIApplicationCommandOption;
|
||||
}
|
||||
//# sourceMappingURL=SlashCommandBuilder.d.ts.map
|
||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"SlashCommandBuilder.d.ts","sourceRoot":"/","sources":["interactions/slashCommands/SlashCommandBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AAGxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,6BAA6B,EAAE,kCAAkC,EAAE,MAAM,2BAA2B,CAAC;AAE9G,qBACa,mBAAmB;IAC/B;;OAEG;IACH,SAAgB,IAAI,EAAE,MAAM,CAAc;IAE1C;;OAEG;IACH,SAAgB,WAAW,EAAE,MAAM,CAAc;IAEjD;;OAEG;IACH,SAAgB,OAAO,EAAE,8BAA8B,EAAE,CAAM;IAE/D;;;;OAIG;IACI,MAAM;;;;;IASb;;;OAGG;IACI,kBAAkB,CACxB,KAAK,EACF,kCAAkC,GAClC,CAAC,CAAC,eAAe,EAAE,kCAAkC,KAAK,kCAAkC,CAAC,GAC9F,uCAAuC;IAqB1C;;;OAGG;IACI,aAAa,CACnB,KAAK,EACF,6BAA6B,GAC7B,CAAC,CAAC,eAAe,EAAE,6BAA6B,KAAK,6BAA6B,CAAC,GACpF,kCAAkC;CAqBrC;AAED,MAAM,WAAW,mBAAoB,SAAQ,wBAAwB,EAAE,yBAAyB;CAAG;AAEnG,MAAM,WAAW,kCAChB,SAAQ,wBAAwB,EAC/B,IAAI,CAAC,mBAAmB,EAAE,QAAQ,GAAG,eAAe,CAAC;CAAG;AAE1D,MAAM,WAAW,uCAChB,SAAQ,wBAAwB,EAC/B,IAAI,CAAC,mBAAmB,EAAE,QAAQ,GAAG,oBAAoB,CAAC;CAAG;AAE/D,MAAM,WAAW,8BAChB,SAAQ,wBAAwB,EAC/B,yBAAyB,EACzB,IAAI,CAAC,mBAAmB,EAAE,QAAQ,CAAC;CAAG;AAExC,MAAM,WAAW,8BAA8B;IAC9C,MAAM,IAAI,2BAA2B,CAAC;CACtC"}
|
||||
Generated
Vendored
-96
@@ -1,96 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SlashCommandBuilder = void 0;
|
||||
const tslib_1 = require("tslib");
|
||||
const ts_mixer_1 = require("ts-mixer");
|
||||
const Assertions_1 = require("./Assertions");
|
||||
const NameAndDescription_1 = require("./mixins/NameAndDescription");
|
||||
const CommandOptions_1 = require("./mixins/CommandOptions");
|
||||
const SlashCommandSubcommands_1 = require("./SlashCommandSubcommands");
|
||||
let SlashCommandBuilder = class SlashCommandBuilder {
|
||||
constructor() {
|
||||
/**
|
||||
* The name of this slash command
|
||||
*/
|
||||
Object.defineProperty(this, "name", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: undefined
|
||||
});
|
||||
/**
|
||||
* The description of this slash command
|
||||
*/
|
||||
Object.defineProperty(this, "description", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: undefined
|
||||
});
|
||||
/**
|
||||
* The options of this slash command
|
||||
*/
|
||||
Object.defineProperty(this, "options", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: []
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Returns the final data that should be sent to Discord.
|
||||
*
|
||||
* **Note:** Calling this function will validate required properties based on their conditions.
|
||||
*/
|
||||
toJSON() {
|
||||
Assertions_1.validateRequiredParameters(this.name, this.description, this.options);
|
||||
return {
|
||||
name: this.name,
|
||||
description: this.description,
|
||||
options: this.options.map((option) => option.toJSON()),
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Adds a new subcommand group to this command
|
||||
* @param input A function that returns a subcommand group builder, or an already built builder
|
||||
*/
|
||||
addSubcommandGroup(input) {
|
||||
const { options } = this;
|
||||
// First, assert options conditions - we cannot have more than 25 options
|
||||
Assertions_1.validateMaxOptionsLength(options);
|
||||
// Make sure there is no subcommand at the root level - if there is, throw
|
||||
const hasSubcommands = options.some((item) => item instanceof SlashCommandSubcommands_1.SlashCommandSubcommandBuilder);
|
||||
if (hasSubcommands)
|
||||
throw new RangeError(`You cannot mix subcommands and subcommand groups at the root level.`);
|
||||
// Get the final result
|
||||
const result = typeof input === 'function' ? input(new SlashCommandSubcommands_1.SlashCommandSubcommandGroupBuilder()) : input;
|
||||
Assertions_1.assertReturnOfBuilder(result, SlashCommandSubcommands_1.SlashCommandSubcommandGroupBuilder);
|
||||
// Push it
|
||||
options.push(result);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Adds a new subcommand to this command
|
||||
* @param input A function that returns a subcommand builder, or an already built builder
|
||||
*/
|
||||
addSubcommand(input) {
|
||||
const { options } = this;
|
||||
// First, assert options conditions - we cannot have more than 25 options
|
||||
Assertions_1.validateMaxOptionsLength(options);
|
||||
// Make sure there is no subcommand at the root level - if there is, throw
|
||||
const hasSubcommandGroups = options.some((item) => item instanceof SlashCommandSubcommands_1.SlashCommandSubcommandGroupBuilder);
|
||||
if (hasSubcommandGroups)
|
||||
throw new RangeError(`You cannot mix subcommands and subcommand groups at the root level.`);
|
||||
// Get the final result
|
||||
const result = typeof input === 'function' ? input(new SlashCommandSubcommands_1.SlashCommandSubcommandBuilder()) : input;
|
||||
Assertions_1.assertReturnOfBuilder(result, SlashCommandSubcommands_1.SlashCommandSubcommandBuilder);
|
||||
// Push it
|
||||
options.push(result);
|
||||
return this;
|
||||
}
|
||||
};
|
||||
SlashCommandBuilder = tslib_1.__decorate([
|
||||
ts_mixer_1.mix(CommandOptions_1.SharedSlashCommandOptions, NameAndDescription_1.SharedNameAndDescription)
|
||||
], SlashCommandBuilder);
|
||||
exports.SlashCommandBuilder = SlashCommandBuilder;
|
||||
//# sourceMappingURL=SlashCommandBuilder.js.map
|
||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"SlashCommandBuilder.js","sourceRoot":"/","sources":["interactions/slashCommands/SlashCommandBuilder.ts"],"names":[],"mappings":";;;;AACA,uCAA+B;AAC/B,6CAA2G;AAC3G,oEAAuE;AACvE,4DAAoE;AACpE,uEAA8G;AAG9G,IAAa,mBAAmB,GAAhC,MAAa,mBAAmB;IAAhC;QACC;;WAEG;QACH;;;;mBAA+B,SAAU;WAAC;QAE1C;;WAEG;QACH;;;;mBAAsC,SAAU;WAAC;QAEjD;;WAEG;QACH;;;;mBAA4D,EAAE;WAAC;IA0EhE,CAAC;IAxEA;;;;OAIG;IACI,MAAM;QACZ,uCAA0B,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACtE,OAAO;YACN,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;SACtD,CAAC;IACH,CAAC;IAED;;;OAGG;IACI,kBAAkB,CACxB,KAEgG;QAEhG,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QAEzB,yEAAyE;QACzE,qCAAwB,CAAC,OAAO,CAAC,CAAC;QAElC,0EAA0E;QAC1E,MAAM,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,YAAY,uDAA6B,CAAC,CAAC;QAC7F,IAAI,cAAc;YAAE,MAAM,IAAI,UAAU,CAAC,qEAAqE,CAAC,CAAC;QAEhH,uBAAuB;QACvB,MAAM,MAAM,GAAG,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,4DAAkC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAErG,kCAAqB,CAAC,MAAM,EAAE,4DAAkC,CAAC,CAAC;QAElE,UAAU;QACV,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAErB,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;OAGG;IACI,aAAa,CACnB,KAEsF;QAEtF,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QAEzB,yEAAyE;QACzE,qCAAwB,CAAC,OAAO,CAAC,CAAC;QAElC,0EAA0E;QAC1E,MAAM,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,YAAY,4DAAkC,CAAC,CAAC;QACvG,IAAI,mBAAmB;YACtB,MAAM,IAAI,UAAU,CAAC,qEAAqE,CAAC,CAAC;QAE7F,uBAAuB;QACvB,MAAM,MAAM,GAAG,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,uDAA6B,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAEhG,kCAAqB,CAAC,MAAM,EAAE,uDAA6B,CAAC,CAAC;QAE7D,UAAU;QACV,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAErB,OAAO,IAAI,CAAC;IACb,CAAC;CACD,CAAA;AAxFY,mBAAmB;IAD/B,cAAG,CAAC,0CAAyB,EAAE,6CAAwB,CAAC;GAC5C,mBAAmB,CAwF/B;AAxFY,kDAAmB","sourcesContent":["import type { APIApplicationCommandOption } from 'discord-api-types/v9';\nimport { mix } from 'ts-mixer';\nimport { assertReturnOfBuilder, validateMaxOptionsLength, validateRequiredParameters } from './Assertions';\nimport { SharedNameAndDescription } from './mixins/NameAndDescription';\nimport { SharedSlashCommandOptions } from './mixins/CommandOptions';\nimport { SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder } from './SlashCommandSubcommands';\n\n@mix(SharedSlashCommandOptions, SharedNameAndDescription)\nexport class SlashCommandBuilder {\n\t/**\n\t * The name of this slash command\n\t */\n\tpublic readonly name: string = undefined!;\n\n\t/**\n\t * The description of this slash command\n\t */\n\tpublic readonly description: string = undefined!;\n\n\t/**\n\t * The options of this slash command\n\t */\n\tpublic readonly options: ToAPIApplicationCommandOptions[] = [];\n\n\t/**\n\t * Returns the final data that should be sent to Discord.\n\t *\n\t * **Note:** Calling this function will validate required properties based on their conditions.\n\t */\n\tpublic toJSON() {\n\t\tvalidateRequiredParameters(this.name, this.description, this.options);\n\t\treturn {\n\t\t\tname: this.name,\n\t\t\tdescription: this.description,\n\t\t\toptions: this.options.map((option) => option.toJSON()),\n\t\t};\n\t}\n\n\t/**\n\t * Adds a new subcommand group to this command\n\t * @param input A function that returns a subcommand group builder, or an already built builder\n\t */\n\tpublic addSubcommandGroup(\n\t\tinput:\n\t\t\t| SlashCommandSubcommandGroupBuilder\n\t\t\t| ((subcommandGroup: SlashCommandSubcommandGroupBuilder) => SlashCommandSubcommandGroupBuilder),\n\t): SlashCommandSubcommandGroupsOnlyBuilder {\n\t\tconst { options } = this;\n\n\t\t// First, assert options conditions - we cannot have more than 25 options\n\t\tvalidateMaxOptionsLength(options);\n\n\t\t// Make sure there is no subcommand at the root level - if there is, throw\n\t\tconst hasSubcommands = options.some((item) => item instanceof SlashCommandSubcommandBuilder);\n\t\tif (hasSubcommands) throw new RangeError(`You cannot mix subcommands and subcommand groups at the root level.`);\n\n\t\t// Get the final result\n\t\tconst result = typeof input === 'function' ? input(new SlashCommandSubcommandGroupBuilder()) : input;\n\n\t\tassertReturnOfBuilder(result, SlashCommandSubcommandGroupBuilder);\n\n\t\t// Push it\n\t\toptions.push(result);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds a new subcommand to this command\n\t * @param input A function that returns a subcommand builder, or an already built builder\n\t */\n\tpublic addSubcommand(\n\t\tinput:\n\t\t\t| SlashCommandSubcommandBuilder\n\t\t\t| ((subcommandGroup: SlashCommandSubcommandBuilder) => SlashCommandSubcommandBuilder),\n\t): SlashCommandSubcommandsOnlyBuilder {\n\t\tconst { options } = this;\n\n\t\t// First, assert options conditions - we cannot have more than 25 options\n\t\tvalidateMaxOptionsLength(options);\n\n\t\t// Make sure there is no subcommand at the root level - if there is, throw\n\t\tconst hasSubcommandGroups = options.some((item) => itLine truncated
|
||||
Generated
Vendored
-64
@@ -1,64 +0,0 @@
|
||||
import { ApplicationCommandOptionType } from 'discord-api-types/v9';
|
||||
import { SharedSlashCommandOptions } from './mixins/CommandOptions';
|
||||
import { SharedNameAndDescription } from './mixins/NameAndDescription';
|
||||
import type { ToAPIApplicationCommandOptions } from './SlashCommandBuilder';
|
||||
/**
|
||||
* Represents a folder for subcommands
|
||||
*
|
||||
* For more information, go to https://discord.com/developers/docs/interactions/slash-commands#subcommands-and-subcommand-groups
|
||||
*/
|
||||
export declare class SlashCommandSubcommandGroupBuilder implements ToAPIApplicationCommandOptions {
|
||||
/**
|
||||
* The name of this subcommand group
|
||||
*/
|
||||
readonly name: string;
|
||||
/**
|
||||
* The description of this subcommand group
|
||||
*/
|
||||
readonly description: string;
|
||||
/**
|
||||
* The subcommands part of this subcommand group
|
||||
*/
|
||||
readonly options: ToAPIApplicationCommandOptions[];
|
||||
/**
|
||||
* Adds a new subcommand to this group
|
||||
* @param input A function that returns a subcommand builder, or an already built builder
|
||||
*/
|
||||
addSubcommand(input: SlashCommandSubcommandBuilder | ((subcommandGroup: SlashCommandSubcommandBuilder) => SlashCommandSubcommandBuilder)): this;
|
||||
toJSON(): {
|
||||
type: ApplicationCommandOptionType;
|
||||
name: string;
|
||||
description: string;
|
||||
options: import("discord-api-types/v9").APIApplicationCommandOption[];
|
||||
};
|
||||
}
|
||||
export interface SlashCommandSubcommandGroupBuilder extends SharedNameAndDescription {
|
||||
}
|
||||
/**
|
||||
* Represents a subcommand
|
||||
*
|
||||
* For more information, go to https://discord.com/developers/docs/interactions/slash-commands#subcommands-and-subcommand-groups
|
||||
*/
|
||||
export declare class SlashCommandSubcommandBuilder implements ToAPIApplicationCommandOptions {
|
||||
/**
|
||||
* The name of this subcommand
|
||||
*/
|
||||
readonly name: string;
|
||||
/**
|
||||
* The description of this subcommand
|
||||
*/
|
||||
readonly description: string;
|
||||
/**
|
||||
* The options of this subcommand
|
||||
*/
|
||||
readonly options: ToAPIApplicationCommandOptions[];
|
||||
toJSON(): {
|
||||
type: ApplicationCommandOptionType;
|
||||
name: string;
|
||||
description: string;
|
||||
options: import("discord-api-types/v9").APIApplicationCommandOption[];
|
||||
};
|
||||
}
|
||||
export interface SlashCommandSubcommandBuilder extends SharedNameAndDescription, SharedSlashCommandOptions<false> {
|
||||
}
|
||||
//# sourceMappingURL=SlashCommandSubcommands.d.ts.map
|
||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"SlashCommandSubcommands.d.ts","sourceRoot":"/","sources":["interactions/slashCommands/SlashCommandSubcommands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAGpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AAE5E;;;;GAIG;AACH,qBACa,kCAAmC,YAAW,8BAA8B;IACxF;;OAEG;IACH,SAAgB,IAAI,EAAE,MAAM,CAAc;IAE1C;;OAEG;IACH,SAAgB,WAAW,EAAE,MAAM,CAAc;IAEjD;;OAEG;IACH,SAAgB,OAAO,EAAE,8BAA8B,EAAE,CAAM;IAE/D;;;OAGG;IACI,aAAa,CACnB,KAAK,EACF,6BAA6B,GAC7B,CAAC,CAAC,eAAe,EAAE,6BAA6B,KAAK,6BAA6B,CAAC;IAkBhF,MAAM;;;;;;CASb;AAED,MAAM,WAAW,kCAAmC,SAAQ,wBAAwB;CAAG;AAEvF;;;;GAIG;AACH,qBACa,6BAA8B,YAAW,8BAA8B;IACnF;;OAEG;IACH,SAAgB,IAAI,EAAE,MAAM,CAAc;IAE1C;;OAEG;IACH,SAAgB,WAAW,EAAE,MAAM,CAAc;IAEjD;;OAEG;IACH,SAAgB,OAAO,EAAE,8BAA8B,EAAE,CAAM;IAExD,MAAM;;;;;;CASb;AAED,MAAM,WAAW,6BAA8B,SAAQ,wBAAwB,EAAE,yBAAyB,CAAC,KAAK,CAAC;CAAG"}
|
||||
Generated
Vendored
-123
@@ -1,123 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SlashCommandSubcommandBuilder = exports.SlashCommandSubcommandGroupBuilder = void 0;
|
||||
const tslib_1 = require("tslib");
|
||||
require("discord-api-types/v9");
|
||||
const ts_mixer_1 = require("ts-mixer");
|
||||
const Assertions_1 = require("./Assertions");
|
||||
const CommandOptions_1 = require("./mixins/CommandOptions");
|
||||
const NameAndDescription_1 = require("./mixins/NameAndDescription");
|
||||
/**
|
||||
* Represents a folder for subcommands
|
||||
*
|
||||
* For more information, go to https://discord.com/developers/docs/interactions/slash-commands#subcommands-and-subcommand-groups
|
||||
*/
|
||||
let SlashCommandSubcommandGroupBuilder = class SlashCommandSubcommandGroupBuilder {
|
||||
constructor() {
|
||||
/**
|
||||
* The name of this subcommand group
|
||||
*/
|
||||
Object.defineProperty(this, "name", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: undefined
|
||||
});
|
||||
/**
|
||||
* The description of this subcommand group
|
||||
*/
|
||||
Object.defineProperty(this, "description", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: undefined
|
||||
});
|
||||
/**
|
||||
* The subcommands part of this subcommand group
|
||||
*/
|
||||
Object.defineProperty(this, "options", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: []
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Adds a new subcommand to this group
|
||||
* @param input A function that returns a subcommand builder, or an already built builder
|
||||
*/
|
||||
addSubcommand(input) {
|
||||
const { options } = this;
|
||||
// First, assert options conditions - we cannot have more than 25 options
|
||||
Assertions_1.validateMaxOptionsLength(options);
|
||||
// Get the final result
|
||||
const result = typeof input === 'function' ? input(new SlashCommandSubcommandBuilder()) : input;
|
||||
Assertions_1.assertReturnOfBuilder(result, SlashCommandSubcommandBuilder);
|
||||
// Push it
|
||||
options.push(result);
|
||||
return this;
|
||||
}
|
||||
toJSON() {
|
||||
Assertions_1.validateRequiredParameters(this.name, this.description, this.options);
|
||||
return {
|
||||
type: 2 /* SubcommandGroup */,
|
||||
name: this.name,
|
||||
description: this.description,
|
||||
options: this.options.map((option) => option.toJSON()),
|
||||
};
|
||||
}
|
||||
};
|
||||
SlashCommandSubcommandGroupBuilder = tslib_1.__decorate([
|
||||
ts_mixer_1.mix(NameAndDescription_1.SharedNameAndDescription)
|
||||
], SlashCommandSubcommandGroupBuilder);
|
||||
exports.SlashCommandSubcommandGroupBuilder = SlashCommandSubcommandGroupBuilder;
|
||||
/**
|
||||
* Represents a subcommand
|
||||
*
|
||||
* For more information, go to https://discord.com/developers/docs/interactions/slash-commands#subcommands-and-subcommand-groups
|
||||
*/
|
||||
let SlashCommandSubcommandBuilder = class SlashCommandSubcommandBuilder {
|
||||
constructor() {
|
||||
/**
|
||||
* The name of this subcommand
|
||||
*/
|
||||
Object.defineProperty(this, "name", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: undefined
|
||||
});
|
||||
/**
|
||||
* The description of this subcommand
|
||||
*/
|
||||
Object.defineProperty(this, "description", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: undefined
|
||||
});
|
||||
/**
|
||||
* The options of this subcommand
|
||||
*/
|
||||
Object.defineProperty(this, "options", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: []
|
||||
});
|
||||
}
|
||||
toJSON() {
|
||||
Assertions_1.validateRequiredParameters(this.name, this.description, this.options);
|
||||
return {
|
||||
type: 1 /* Subcommand */,
|
||||
name: this.name,
|
||||
description: this.description,
|
||||
options: this.options.map((option) => option.toJSON()),
|
||||
};
|
||||
}
|
||||
};
|
||||
SlashCommandSubcommandBuilder = tslib_1.__decorate([
|
||||
ts_mixer_1.mix(NameAndDescription_1.SharedNameAndDescription, CommandOptions_1.SharedSlashCommandOptions)
|
||||
], SlashCommandSubcommandBuilder);
|
||||
exports.SlashCommandSubcommandBuilder = SlashCommandSubcommandBuilder;
|
||||
//# sourceMappingURL=SlashCommandSubcommands.js.map
|
||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"SlashCommandSubcommands.js","sourceRoot":"/","sources":["interactions/slashCommands/SlashCommandSubcommands.ts"],"names":[],"mappings":";;;;AAAA,gCAAoE;AACpE,uCAA+B;AAC/B,6CAA2G;AAC3G,4DAAoE;AACpE,oEAAuE;AAGvE;;;;GAIG;AAEH,IAAa,kCAAkC,GAA/C,MAAa,kCAAkC;IAA/C;QACC;;WAEG;QACH;;;;mBAA+B,SAAU;WAAC;QAE1C;;WAEG;QACH;;;;mBAAsC,SAAU;WAAC;QAEjD;;WAEG;QACH;;;;mBAA4D,EAAE;WAAC;IAoChE,CAAC;IAlCA;;;OAGG;IACI,aAAa,CACnB,KAEsF;QAEtF,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QAEzB,yEAAyE;QACzE,qCAAwB,CAAC,OAAO,CAAC,CAAC;QAElC,uBAAuB;QACvB,MAAM,MAAM,GAAG,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,6BAA6B,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAEhG,kCAAqB,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC;QAE7D,UAAU;QACV,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAErB,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,MAAM;QACZ,uCAA0B,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACtE,OAAO;YACN,IAAI,yBAA8C;YAClD,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;SACtD,CAAC;IACH,CAAC;CACD,CAAA;AAlDY,kCAAkC;IAD9C,cAAG,CAAC,6CAAwB,CAAC;GACjB,kCAAkC,CAkD9C;AAlDY,gFAAkC;AAsD/C;;;;GAIG;AAEH,IAAa,6BAA6B,GAA1C,MAAa,6BAA6B;IAA1C;QACC;;WAEG;QACH;;;;mBAA+B,SAAU;WAAC;QAE1C;;WAEG;QACH;;;;mBAAsC,SAAU;WAAC;QAEjD;;WAEG;QACH;;;;mBAA4D,EAAE;WAAC;IAWhE,CAAC;IATO,MAAM;QACZ,uCAA0B,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACtE,OAAO;YACN,IAAI,oBAAyC;YAC7C,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;SACtD,CAAC;IACH,CAAC;CACD,CAAA;AAzBY,6BAA6B;IADzC,cAAG,CAAC,6CAAwB,EAAE,0CAAyB,CAAC;GAC5C,6BAA6B,CAyBzC;AAzBY,sEAA6B","sourcesContent":["import { ApplicationCommandOptionType } from 'discord-api-types/v9';\nimport { mix } from 'ts-mixer';\nimport { assertReturnOfBuilder, validateMaxOptionsLength, validateRequiredParameters } from './Assertions';\nimport { SharedSlashCommandOptions } from './mixins/CommandOptions';\nimport { SharedNameAndDescription } from './mixins/NameAndDescription';\nimport type { ToAPIApplicationCommandOptions } from './SlashCommandBuilder';\n\n/**\n * Represents a folder for subcommands\n *\n * For more information, go to https://discord.com/developers/docs/interactions/slash-commands#subcommands-and-subcommand-groups\n */\n@mix(SharedNameAndDescription)\nexport class SlashCommandSubcommandGroupBuilder implements ToAPIApplicationCommandOptions {\n\t/**\n\t * The name of this subcommand group\n\t */\n\tpublic readonly name: string = undefined!;\n\n\t/**\n\t * The description of this subcommand group\n\t */\n\tpublic readonly description: string = undefined!;\n\n\t/**\n\t * The subcommands part of this subcommand group\n\t */\n\tpublic readonly options: ToAPIApplicationCommandOptions[] = [];\n\n\t/**\n\t * Adds a new subcommand to this group\n\t * @param input A function that returns a subcommand builder, or an already built builder\n\t */\n\tpublic addSubcommand(\n\t\tinput:\n\t\t\t| SlashCommandSubcommandBuilder\n\t\t\t| ((subcommandGroup: SlashCommandSubcommandBuilder) => SlashCommandSubcommandBuilder),\n\t) {\n\t\tconst { options } = this;\n\n\t\t// First, assert options conditions - we cannot have more than 25 options\n\t\tvalidateMaxOptionsLength(options);\n\n\t\t// Get the final result\n\t\tconst result = typeof input === 'function' ? input(new SlashCommandSubcommandBuilder()) : input;\n\n\t\tassertReturnOfBuilder(result, SlashCommandSubcommandBuilder);\n\n\t\t// Push it\n\t\toptions.push(result);\n\n\t\treturn this;\n\t}\n\n\tpublic toJSON() {\n\t\tvalidateRequiredParameters(this.name, this.description, this.options);\n\t\treturn {\n\t\t\ttype: ApplicationCommandOptionType.SubcommandGroup,\n\t\t\tname: this.name,\n\t\t\tdescription: this.description,\n\t\t\toptions: this.options.map((option) => option.toJSON()),\n\t\t};\n\t}\n}\n\nexport interface SlashCommandSubcommandGroupBuilder extends SharedNameAndDescription {}\n\n/**\n * Represents a subcommand\n *\n * For more information, go to https://discord.com/developers/docs/interactions/slash-commands#subcommands-and-subcommand-groups\n */\n@mix(SharedNameAndDescription, SharedSlashCommandOptions)\nexport class SlashCommandSubcommandBuilder implements ToAPIApplicationCommandOptions {\n\t/**\n\t * The name of this subcommand\n\t */\n\tpublic readonly name: string = undefined!;\n\n\t/**\n\t * The description of this subcommand\n\t */\n\tpublic readonly description: string = undefined!;\n\n\t/**\n\t * The options of this subcommand\n\t */\n\tpublic readonly options: ToAPIApplicationCommandOptions[] = [];\n\n\tpublic toJSON() {\n\t\tvalidateRequiredParameters(this.name, this.description, this.options);\n\t\treturn {\n\t\t\ttype: ApplicationCommandOptionType.Subcommand,\n\t\t\tname: this.name,\n\t\t\tdescription: this.description,\n\t\t\toptions: this.options.map((option) => option.toJSON()),\n\t\t};\n\t}\n}\n\nexport interface SlashCommandSubcommandBuilLine truncated
|
||||
Generated
Vendored
-20
@@ -1,20 +0,0 @@
|
||||
import type { ApplicationCommandOptionType } from 'discord-api-types/v9';
|
||||
import type { ToAPIApplicationCommandOptions } from '../SlashCommandBuilder';
|
||||
import { SharedNameAndDescription } from './NameAndDescription';
|
||||
export declare class SlashCommandOptionBase extends SharedNameAndDescription implements ToAPIApplicationCommandOptions {
|
||||
required: boolean;
|
||||
readonly type: ApplicationCommandOptionType;
|
||||
constructor(type: ApplicationCommandOptionType);
|
||||
/**
|
||||
* Marks the option as required
|
||||
* @param required If this option should be required
|
||||
*/
|
||||
setRequired(required: boolean): this;
|
||||
toJSON(): {
|
||||
type: ApplicationCommandOptionType;
|
||||
name: string;
|
||||
description: string;
|
||||
required: boolean;
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=CommandOptionBase.d.ts.map
|
||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"CommandOptionBase.d.ts","sourceRoot":"/","sources":["interactions/slashCommands/mixins/CommandOptionBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAGzE,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,qBAAa,sBAAuB,SAAQ,wBAAyB,YAAW,8BAA8B;IACtG,QAAQ,UAAS;IACxB,SAAgB,IAAI,EAAE,4BAA4B,CAAC;gBAEhC,IAAI,EAAE,4BAA4B;IAKrD;;;OAGG;IACI,WAAW,CAAC,QAAQ,EAAE,OAAO;IAS7B,MAAM;;;;;;CAab"}
|
||||
Generated
Vendored
-48
@@ -1,48 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SlashCommandOptionBase = void 0;
|
||||
const tslib_1 = require("tslib");
|
||||
const ow_1 = tslib_1.__importDefault(require("ow"));
|
||||
const Assertions_1 = require("../Assertions");
|
||||
const NameAndDescription_1 = require("./NameAndDescription");
|
||||
class SlashCommandOptionBase extends NameAndDescription_1.SharedNameAndDescription {
|
||||
constructor(type) {
|
||||
super();
|
||||
Object.defineProperty(this, "required", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: false
|
||||
});
|
||||
Object.defineProperty(this, "type", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: void 0
|
||||
});
|
||||
this.type = type;
|
||||
}
|
||||
/**
|
||||
* Marks the option as required
|
||||
* @param required If this option should be required
|
||||
*/
|
||||
setRequired(required) {
|
||||
// Assert that you actually passed a boolean
|
||||
ow_1.default(required, 'required', ow_1.default.boolean);
|
||||
this.required = required;
|
||||
return this;
|
||||
}
|
||||
toJSON() {
|
||||
Assertions_1.validateRequiredParameters(this.name, this.description, []);
|
||||
// Assert that you actually passed a boolean
|
||||
ow_1.default(this.required, 'required', ow_1.default.boolean);
|
||||
return {
|
||||
type: this.type,
|
||||
name: this.name,
|
||||
description: this.description,
|
||||
required: this.required,
|
||||
};
|
||||
}
|
||||
}
|
||||
exports.SlashCommandOptionBase = SlashCommandOptionBase;
|
||||
//# sourceMappingURL=CommandOptionBase.js.map
|
||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"CommandOptionBase.js","sourceRoot":"/","sources":["interactions/slashCommands/mixins/CommandOptionBase.ts"],"names":[],"mappings":";;;;AACA,oDAAoB;AACpB,8CAA2D;AAE3D,6DAAgE;AAEhE,MAAa,sBAAuB,SAAQ,6CAAwB;IAInE,YAAmB,IAAkC;QACpD,KAAK,EAAE,CAAC;QAJT;;;;mBAAkB,KAAK;WAAC;QACxB;;;;;WAAmD;QAIlD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAClB,CAAC;IAED;;;OAGG;IACI,WAAW,CAAC,QAAiB;QACnC,4CAA4C;QAC5C,YAAE,CAAC,QAAQ,EAAE,UAAU,EAAE,YAAE,CAAC,OAAO,CAAC,CAAC;QAErC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,MAAM;QACZ,uCAA0B,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QAE5D,4CAA4C;QAC5C,YAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,YAAE,CAAC,OAAO,CAAC,CAAC;QAE1C,OAAO;YACN,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACvB,CAAC;IACH,CAAC;CACD;AAnCD,wDAmCC","sourcesContent":["import type { ApplicationCommandOptionType } from 'discord-api-types/v9';\nimport ow from 'ow';\nimport { validateRequiredParameters } from '../Assertions';\nimport type { ToAPIApplicationCommandOptions } from '../SlashCommandBuilder';\nimport { SharedNameAndDescription } from './NameAndDescription';\n\nexport class SlashCommandOptionBase extends SharedNameAndDescription implements ToAPIApplicationCommandOptions {\n\tpublic required = false;\n\tpublic readonly type: ApplicationCommandOptionType;\n\n\tpublic constructor(type: ApplicationCommandOptionType) {\n\t\tsuper();\n\t\tthis.type = type;\n\t}\n\n\t/**\n\t * Marks the option as required\n\t * @param required If this option should be required\n\t */\n\tpublic setRequired(required: boolean) {\n\t\t// Assert that you actually passed a boolean\n\t\tow(required, 'required', ow.boolean);\n\n\t\tthis.required = required;\n\n\t\treturn this;\n\t}\n\n\tpublic toJSON() {\n\t\tvalidateRequiredParameters(this.name, this.description, []);\n\n\t\t// Assert that you actually passed a boolean\n\t\tow(this.required, 'required', ow.boolean);\n\n\t\treturn {\n\t\t\ttype: this.type,\n\t\t\tname: this.name,\n\t\t\tdescription: this.description,\n\t\t\trequired: this.required,\n\t\t};\n\t}\n}\n"]}
|
||||
Generated
Vendored
-25
@@ -1,25 +0,0 @@
|
||||
import { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from 'discord-api-types/v9';
|
||||
import type { ToAPIApplicationCommandOptions } from '../SlashCommandBuilder';
|
||||
import { SlashCommandOptionBase } from './CommandOptionBase';
|
||||
export declare abstract class ApplicationCommandOptionWithChoicesBase<T extends string | number> extends SlashCommandOptionBase implements ToAPIApplicationCommandOptions {
|
||||
choices?: APIApplicationCommandOptionChoice[];
|
||||
/**
|
||||
* Adds a choice for this option
|
||||
* @param name The name of the choice
|
||||
* @param value The value of the choice
|
||||
*/
|
||||
addChoice(name: string, value: T): this;
|
||||
/**
|
||||
* Adds multiple choices for this option
|
||||
* @param choices The choices to add
|
||||
*/
|
||||
addChoices(choices: [name: string, value: T][]): this;
|
||||
toJSON(): {
|
||||
choices: APIApplicationCommandOptionChoice[] | undefined;
|
||||
type: ApplicationCommandOptionType;
|
||||
name: string;
|
||||
description: string;
|
||||
required: boolean;
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=CommandOptionWithChoices.d.ts.map
|
||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"CommandOptionWithChoices.d.ts","sourceRoot":"/","sources":["interactions/slashCommands/mixins/CommandOptionWithChoices.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iCAAiC,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAGvG,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAU7D,8BAAsB,uCAAuC,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CACtF,SAAQ,sBACR,YAAW,8BAA8B;IAElC,OAAO,CAAC,EAAE,iCAAiC,EAAE,CAAC;IAErD;;;;OAIG;IACI,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAqBvC;;;OAGG;IACI,UAAU,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE;IAWrC,MAAM;;;;;;;CAMtB"}
|
||||
Generated
Vendored
-59
@@ -1,59 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ApplicationCommandOptionWithChoicesBase = void 0;
|
||||
const tslib_1 = require("tslib");
|
||||
require("discord-api-types/v9");
|
||||
const ow_1 = tslib_1.__importDefault(require("ow"));
|
||||
const Assertions_1 = require("../Assertions");
|
||||
const CommandOptionBase_1 = require("./CommandOptionBase");
|
||||
const stringPredicate = ow_1.default.string.minLength(1).maxLength(100);
|
||||
const integerPredicate = ow_1.default.number.finite;
|
||||
// TODO: See resolution for sindresorhus/ow#217 in relation to this cast
|
||||
const choicesPredicate = ow_1.default.array.ofType(ow_1.default.array.exactShape([stringPredicate, ow_1.default.any(ow_1.default.string, integerPredicate)]));
|
||||
class ApplicationCommandOptionWithChoicesBase extends CommandOptionBase_1.SlashCommandOptionBase {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
Object.defineProperty(this, "choices", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: void 0
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Adds a choice for this option
|
||||
* @param name The name of the choice
|
||||
* @param value The value of the choice
|
||||
*/
|
||||
addChoice(name, value) {
|
||||
this.choices ?? (this.choices = []);
|
||||
Assertions_1.validateMaxChoicesLength(this.choices);
|
||||
// Validate name
|
||||
ow_1.default(name, `${this.type === 3 /* String */ ? 'string' : 'integer'} choice name`, stringPredicate);
|
||||
// Validate the value
|
||||
if (this.type === 3 /* String */)
|
||||
ow_1.default(value, 'string choice value', stringPredicate);
|
||||
else
|
||||
ow_1.default(value, 'integer choice value', integerPredicate);
|
||||
this.choices.push({ name, value });
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Adds multiple choices for this option
|
||||
* @param choices The choices to add
|
||||
*/
|
||||
addChoices(choices) {
|
||||
ow_1.default(choices, `${this.type === 3 /* String */ ? 'string' : 'integer'} choices`, choicesPredicate);
|
||||
for (const [label, value] of choices)
|
||||
this.addChoice(label, value);
|
||||
return this;
|
||||
}
|
||||
toJSON() {
|
||||
return {
|
||||
...super.toJSON(),
|
||||
choices: this.choices,
|
||||
};
|
||||
}
|
||||
}
|
||||
exports.ApplicationCommandOptionWithChoicesBase = ApplicationCommandOptionWithChoicesBase;
|
||||
//# sourceMappingURL=CommandOptionWithChoices.js.map
|
||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"CommandOptionWithChoices.js","sourceRoot":"/","sources":["interactions/slashCommands/mixins/CommandOptionWithChoices.ts"],"names":[],"mappings":";;;;AAAA,gCAAuG;AACvG,oDAAmC;AACnC,8CAAyD;AAEzD,2DAA6D;AAE7D,MAAM,eAAe,GAAG,YAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;AAC9D,MAAM,gBAAgB,GAAG,YAAE,CAAC,MAAM,CAAC,MAAM,CAAC;AAE1C,wEAAwE;AACxE,MAAM,gBAAgB,GAAG,YAAE,CAAC,KAAK,CAAC,MAAM,CACvC,YAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,eAAe,EAAE,YAAE,CAAC,GAAG,CAAC,YAAE,CAAC,MAAM,EAAE,gBAAgB,CAA0C,CAAC,CAAC,CACpH,CAAC;AAEF,MAAsB,uCACrB,SAAQ,0CAAsB;IAD/B;;QAIC;;;;;WAAqD;IAiDtD,CAAC;IA/CA;;;;OAIG;IACI,SAAS,CAAC,IAAY,EAAE,KAAQ;QACtC,IAAI,CAAC,OAAO,KAAZ,IAAI,CAAC,OAAO,GAAK,EAAE,EAAC;QAEpB,qCAAwB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAEvC,gBAAgB;QAChB,YAAE,CACD,IAAI,EACJ,GAAG,IAAI,CAAC,IAAI,mBAAwC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,cAAc,EACzF,eAAe,CACf,CAAC;QAEF,qBAAqB;QACrB,IAAI,IAAI,CAAC,IAAI,mBAAwC;YAAE,YAAE,CAAC,KAAK,EAAE,qBAAqB,EAAE,eAAe,CAAC,CAAC;;YACpG,YAAE,CAAC,KAAK,EAAE,sBAAsB,EAAE,gBAAgB,CAAC,CAAC;QAEzD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAEnC,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;OAGG;IACI,UAAU,CAAC,OAAmC;QACpD,YAAE,CACD,OAAO,EACP,GAAG,IAAI,CAAC,IAAI,mBAAwC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,UAAU,EACrF,gBAAgB,CAChB,CAAC;QAEF,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,OAAO;YAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACnE,OAAO,IAAI,CAAC;IACb,CAAC;IAEe,MAAM;QACrB,OAAO;YACN,GAAG,KAAK,CAAC,MAAM,EAAE;YACjB,OAAO,EAAE,IAAI,CAAC,OAAO;SACrB,CAAC;IACH,CAAC;CACD;AArDD,0FAqDC","sourcesContent":["import { APIApplicationCommandOptionChoice, ApplicationCommandOptionType } from 'discord-api-types/v9';\nimport ow, { Predicate } from 'ow';\nimport { validateMaxChoicesLength } from '../Assertions';\nimport type { ToAPIApplicationCommandOptions } from '../SlashCommandBuilder';\nimport { SlashCommandOptionBase } from './CommandOptionBase';\n\nconst stringPredicate = ow.string.minLength(1).maxLength(100);\nconst integerPredicate = ow.number.finite;\n\n// TODO: See resolution for sindresorhus/ow#217 in relation to this cast\nconst choicesPredicate = ow.array.ofType<[string, string | number]>(\n\tow.array.exactShape([stringPredicate, ow.any(ow.string, integerPredicate) as unknown as Predicate<string | number>]),\n);\n\nexport abstract class ApplicationCommandOptionWithChoicesBase<T extends string | number>\n\textends SlashCommandOptionBase\n\timplements ToAPIApplicationCommandOptions\n{\n\tpublic choices?: APIApplicationCommandOptionChoice[];\n\n\t/**\n\t * Adds a choice for this option\n\t * @param name The name of the choice\n\t * @param value The value of the choice\n\t */\n\tpublic addChoice(name: string, value: T) {\n\t\tthis.choices ??= [];\n\n\t\tvalidateMaxChoicesLength(this.choices);\n\n\t\t// Validate name\n\t\tow(\n\t\t\tname,\n\t\t\t`${this.type === ApplicationCommandOptionType.String ? 'string' : 'integer'} choice name`,\n\t\t\tstringPredicate,\n\t\t);\n\n\t\t// Validate the value\n\t\tif (this.type === ApplicationCommandOptionType.String) ow(value, 'string choice value', stringPredicate);\n\t\telse ow(value, 'integer choice value', integerPredicate);\n\n\t\tthis.choices.push({ name, value });\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Adds multiple choices for this option\n\t * @param choices The choices to add\n\t */\n\tpublic addChoices(choices: [name: string, value: T][]) {\n\t\tow(\n\t\t\tchoices,\n\t\t\t`${this.type === ApplicationCommandOptionType.String ? 'string' : 'integer'} choices`,\n\t\t\tchoicesPredicate,\n\t\t);\n\n\t\tfor (const [label, value] of choices) this.addChoice(label, value);\n\t\treturn this;\n\t}\n\n\tpublic override toJSON() {\n\t\treturn {\n\t\t\t...super.toJSON(),\n\t\t\tchoices: this.choices,\n\t\t};\n\t}\n}\n"]}
|
||||
Generated
Vendored
-48
@@ -1,48 +0,0 @@
|
||||
import { SlashCommandBooleanOption } from '../options/boolean';
|
||||
import { SlashCommandChannelOption } from '../options/channel';
|
||||
import { SlashCommandIntegerOption } from '../options/integer';
|
||||
import { SlashCommandMentionableOption } from '../options/mentionable';
|
||||
import { SlashCommandRoleOption } from '../options/role';
|
||||
import { SlashCommandStringOption } from '../options/string';
|
||||
import { SlashCommandUserOption } from '../options/user';
|
||||
import type { ToAPIApplicationCommandOptions } from '../SlashCommandBuilder';
|
||||
export declare class SharedSlashCommandOptions<ShouldOmitSubcommandFunctions = true> {
|
||||
readonly options: ToAPIApplicationCommandOptions[];
|
||||
/**
|
||||
* Adds a boolean option
|
||||
* @param input A function that returns an option builder, or an already built builder
|
||||
*/
|
||||
addBooleanOption(input: SlashCommandBooleanOption | ((builder: SlashCommandBooleanOption) => SlashCommandBooleanOption)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
|
||||
/**
|
||||
* Adds a user option
|
||||
* @param input A function that returns an option builder, or an already built builder
|
||||
*/
|
||||
addUserOption(input: SlashCommandUserOption | ((builder: SlashCommandUserOption) => SlashCommandUserOption)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
|
||||
/**
|
||||
* Adds a channel option
|
||||
* @param input A function that returns an option builder, or an already built builder
|
||||
*/
|
||||
addChannelOption(input: SlashCommandChannelOption | ((builder: SlashCommandChannelOption) => SlashCommandChannelOption)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
|
||||
/**
|
||||
* Adds a role option
|
||||
* @param input A function that returns an option builder, or an already built builder
|
||||
*/
|
||||
addRoleOption(input: SlashCommandRoleOption | ((builder: SlashCommandRoleOption) => SlashCommandRoleOption)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
|
||||
/**
|
||||
* Adds a mentionable option
|
||||
* @param input A function that returns an option builder, or an already built builder
|
||||
*/
|
||||
addMentionableOption(input: SlashCommandMentionableOption | ((builder: SlashCommandMentionableOption) => SlashCommandMentionableOption)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
|
||||
/**
|
||||
* Adds a string option
|
||||
* @param input A function that returns an option builder, or an already built builder
|
||||
*/
|
||||
addStringOption(input: SlashCommandStringOption | ((builder: SlashCommandStringOption) => SlashCommandStringOption)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
|
||||
/**
|
||||
* Adds an integer option
|
||||
* @param input A function that returns an option builder, or an already built builder
|
||||
*/
|
||||
addIntegerOption(input: SlashCommandIntegerOption | ((builder: SlashCommandIntegerOption) => SlashCommandIntegerOption)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
|
||||
private _sharedAddOptionMethod;
|
||||
}
|
||||
//# sourceMappingURL=CommandOptions.d.ts.map
|
||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"CommandOptions.d.ts","sourceRoot":"/","sources":["interactions/slashCommands/mixins/CommandOptions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AAE7E,qBAAa,yBAAyB,CAAC,6BAA6B,GAAG,IAAI;IAC1E,SAAgB,OAAO,EAAG,8BAA8B,EAAE,CAAC;IAE3D;;;OAGG;IACI,gBAAgB,CACtB,KAAK,EAAE,yBAAyB,GAAG,CAAC,CAAC,OAAO,EAAE,yBAAyB,KAAK,yBAAyB,CAAC;IAKvG;;;OAGG;IACI,aAAa,CAAC,KAAK,EAAE,sBAAsB,GAAG,CAAC,CAAC,OAAO,EAAE,sBAAsB,KAAK,sBAAsB,CAAC;IAIlH;;;OAGG;IACI,gBAAgB,CACtB,KAAK,EAAE,yBAAyB,GAAG,CAAC,CAAC,OAAO,EAAE,yBAAyB,KAAK,yBAAyB,CAAC;IAKvG;;;OAGG;IACI,aAAa,CAAC,KAAK,EAAE,sBAAsB,GAAG,CAAC,CAAC,OAAO,EAAE,sBAAsB,KAAK,sBAAsB,CAAC;IAIlH;;;OAGG;IACI,oBAAoB,CAC1B,KAAK,EAAE,6BAA6B,GAAG,CAAC,CAAC,OAAO,EAAE,6BAA6B,KAAK,6BAA6B,CAAC;IAKnH;;;OAGG;IACI,eAAe,CACrB,KAAK,EAAE,wBAAwB,GAAG,CAAC,CAAC,OAAO,EAAE,wBAAwB,KAAK,wBAAwB,CAAC;IAKpG;;;OAGG;IACI,gBAAgB,CACtB,KAAK,EAAE,yBAAyB,GAAG,CAAC,CAAC,OAAO,EAAE,yBAAyB,KAAK,yBAAyB,CAAC;IAKvG,OAAO,CAAC,sBAAsB;CAmB9B"}
|
||||
Generated
Vendored
-83
@@ -1,83 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SharedSlashCommandOptions = void 0;
|
||||
const Assertions_1 = require("../Assertions");
|
||||
const boolean_1 = require("../options/boolean");
|
||||
const channel_1 = require("../options/channel");
|
||||
const integer_1 = require("../options/integer");
|
||||
const mentionable_1 = require("../options/mentionable");
|
||||
const role_1 = require("../options/role");
|
||||
const string_1 = require("../options/string");
|
||||
const user_1 = require("../options/user");
|
||||
class SharedSlashCommandOptions {
|
||||
constructor() {
|
||||
Object.defineProperty(this, "options", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: void 0
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Adds a boolean option
|
||||
* @param input A function that returns an option builder, or an already built builder
|
||||
*/
|
||||
addBooleanOption(input) {
|
||||
return this._sharedAddOptionMethod(input, boolean_1.SlashCommandBooleanOption);
|
||||
}
|
||||
/**
|
||||
* Adds a user option
|
||||
* @param input A function that returns an option builder, or an already built builder
|
||||
*/
|
||||
addUserOption(input) {
|
||||
return this._sharedAddOptionMethod(input, user_1.SlashCommandUserOption);
|
||||
}
|
||||
/**
|
||||
* Adds a channel option
|
||||
* @param input A function that returns an option builder, or an already built builder
|
||||
*/
|
||||
addChannelOption(input) {
|
||||
return this._sharedAddOptionMethod(input, channel_1.SlashCommandChannelOption);
|
||||
}
|
||||
/**
|
||||
* Adds a role option
|
||||
* @param input A function that returns an option builder, or an already built builder
|
||||
*/
|
||||
addRoleOption(input) {
|
||||
return this._sharedAddOptionMethod(input, role_1.SlashCommandRoleOption);
|
||||
}
|
||||
/**
|
||||
* Adds a mentionable option
|
||||
* @param input A function that returns an option builder, or an already built builder
|
||||
*/
|
||||
addMentionableOption(input) {
|
||||
return this._sharedAddOptionMethod(input, mentionable_1.SlashCommandMentionableOption);
|
||||
}
|
||||
/**
|
||||
* Adds a string option
|
||||
* @param input A function that returns an option builder, or an already built builder
|
||||
*/
|
||||
addStringOption(input) {
|
||||
return this._sharedAddOptionMethod(input, string_1.SlashCommandStringOption);
|
||||
}
|
||||
/**
|
||||
* Adds an integer option
|
||||
* @param input A function that returns an option builder, or an already built builder
|
||||
*/
|
||||
addIntegerOption(input) {
|
||||
return this._sharedAddOptionMethod(input, integer_1.SlashCommandIntegerOption);
|
||||
}
|
||||
_sharedAddOptionMethod(input, Instance) {
|
||||
const { options } = this;
|
||||
// First, assert options conditions - we cannot have more than 25 options
|
||||
Assertions_1.validateMaxOptionsLength(options);
|
||||
// Get the final result
|
||||
const result = typeof input === 'function' ? input(new Instance()) : input;
|
||||
Assertions_1.assertReturnOfBuilder(result, Instance);
|
||||
// Push it
|
||||
options.push(result);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
exports.SharedSlashCommandOptions = SharedSlashCommandOptions;
|
||||
//# sourceMappingURL=CommandOptions.js.map
|
||||
Generated
Vendored
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"CommandOptions.js","sourceRoot":"/","sources":["interactions/slashCommands/mixins/CommandOptions.ts"],"names":[],"mappings":";;;AAAA,8CAAgF;AAEhF,gDAA+D;AAC/D,gDAA+D;AAC/D,gDAA+D;AAC/D,wDAAuE;AACvE,0CAAyD;AACzD,8CAA6D;AAC7D,0CAAyD;AAGzD,MAAa,yBAAyB;IAAtC;QACC;;;;;WAA2D;IAuF5D,CAAC;IArFA;;;OAGG;IACI,gBAAgB,CACtB,KAAsG;QAEtG,OAAO,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,mCAAyB,CAAC,CAAC;IACtE,CAAC;IAED;;;OAGG;IACI,aAAa,CAAC,KAA6F;QACjH,OAAO,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,6BAAsB,CAAC,CAAC;IACnE,CAAC;IAED;;;OAGG;IACI,gBAAgB,CACtB,KAAsG;QAEtG,OAAO,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,mCAAyB,CAAC,CAAC;IACtE,CAAC;IAED;;;OAGG;IACI,aAAa,CAAC,KAA6F;QACjH,OAAO,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,6BAAsB,CAAC,CAAC;IACnE,CAAC;IAED;;;OAGG;IACI,oBAAoB,CAC1B,KAAkH;QAElH,OAAO,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,2CAA6B,CAAC,CAAC;IAC1E,CAAC;IAED;;;OAGG;IACI,eAAe,CACrB,KAAmG;QAEnG,OAAO,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,iCAAwB,CAAC,CAAC;IACrE,CAAC;IAED;;;OAGG;IACI,gBAAgB,CACtB,KAAsG;QAEtG,OAAO,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,mCAAyB,CAAC,CAAC;IACtE,CAAC;IAEO,sBAAsB,CAC7B,KAA8B,EAC9B,QAAqB;QAErB,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QAEzB,yEAAyE;QACzE,qCAAwB,CAAC,OAAO,CAAC,CAAC;QAElC,uBAAuB;QACvB,MAAM,MAAM,GAAG,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAE3E,kCAAqB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAExC,UAAU;QACV,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAErB,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AAxFD,8DAwFC","sourcesContent":["import { assertReturnOfBuilder, validateMaxOptionsLength } from '../Assertions';\nimport type { SlashCommandOptionBase } from './CommandOptionBase';\nimport { SlashCommandBooleanOption } from '../options/boolean';\nimport { SlashCommandChannelOption } from '../options/channel';\nimport { SlashCommandIntegerOption } from '../options/integer';\nimport { SlashCommandMentionableOption } from '../options/mentionable';\nimport { SlashCommandRoleOption } from '../options/role';\nimport { SlashCommandStringOption } from '../options/string';\nimport { SlashCommandUserOption } from '../options/user';\nimport type { ToAPIApplicationCommandOptions } from '../SlashCommandBuilder';\n\nexport class SharedSlashCommandOptions<ShouldOmitSubcommandFunctions = true> {\n\tpublic readonly options!: ToAPIApplicationCommandOptions[];\n\n\t/**\n\t * Adds a boolean option\n\t * @param input A function that returns an option builder, or an already built builder\n\t */\n\tpublic addBooleanOption(\n\t\tinput: SlashCommandBooleanOption | ((builder: SlashCommandBooleanOption) => SlashCommandBooleanOption),\n\t) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandBooleanOption);\n\t}\n\n\t/**\n\t * Adds a user option\n\t * @param input A function that returns an option builder, or an already built builder\n\t */\n\tpublic addUserOption(input: SlashCommandUserOption | ((builder: SlashCommandUserOption) => SlashCommandUserOption)) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandUserOption);\n\t}\n\n\t/**\n\t * Adds a channel option\n\t * @param input A function that returns an option builder, or an already built builder\n\t */\n\tpublic addChannelOption(\n\t\tinput: SlashCommandChannelOption | ((builder: SlashCommandChannelOption) => SlashCommandChannelOption),\n\t) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandChannelOption);\n\t}\n\n\t/**\n\t * Adds a role option\n\t * @param input A function that returns an option builder, or an already built builder\n\t */\n\tpublic addRoleOption(input: SlashCommandRoleOption | ((builder: SlashCommandRoleOption) => SlashCommandRoleOption)) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandRoleOption);\n\t}\n\n\t/**\n\t * Adds a mentionable option\n\t * @param input A function that returns an option builder, or an already built builder\n\t */\n\tpublic addMentionableOption(\n\t\tinput: SlashCommandMentionableOption | ((builder: SlashCommandMentionableOption) => SlashCommandMentionableOption),\n\t) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandMentionableOption);\n\t}\n\n\t/**\n\t * Adds a string option\n\t * @param input A function that returns an option builder, or an already built builder\n\t */\n\tpublic addStringOption(\n\t\tinput: SlashCommandStringOption | ((builder: SlashCommandStringOption) => SlashCommandStringOption),\n\t) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandStringOption);\n\t}\n\n\t/**\n\t * Adds an integer option\n\t * @param input A function that returns an option builder, or an already built builder\n\t */\n\tpublic addIntegerOption(\n\t\tinput: SlashCommandIntegerOption | ((builder: SlashCommandIntegerOption) => SlashCommandIntegerOption),\n\t) {\n\t\treturn this._sharedAddOptionMethod(input, SlashCommandIntegerOption);\n\t}\n\n\tprivate _sharedAddOptionMethod<T extends SlashCommandOptionBase>(\n\t\tinput: T | ((builder: T) => T),\n\t\tInstance: new () => T,\n\t): ShouldOmitSubcommandFunctions extends true ? Omit<this, 'addSubcommand' | 'addSubcommandGroup'> : this {\n\t\tconLine truncated
|
||||
Loaded 100 of 4823 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user