Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 |
No files matched your search
@@ -1,31 +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
|
|
||||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
+34
-20
@@ -5,27 +5,41 @@ const fs = require("fs");
|
|||||||
|
|
||||||
const Discord = require("discord.js");
|
const Discord = require("discord.js");
|
||||||
const yaml = require("js-yaml");
|
const yaml = require("js-yaml");
|
||||||
const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
|
const supportbot = yaml.load(
|
||||||
const cmdconfig = yaml.load(fs.readFileSync("./Data/commands.yml", "utf8"));
|
fs.readFileSync("./Configs/supportbot.yml", "utf8")
|
||||||
|
);
|
||||||
|
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
|
||||||
|
|
||||||
// Your Addon Config file! Saved in /Addons/Settings/YourAddonConfig.yml
|
// Your Addon Config file! Saved in /Addons/Configs/YourAddonConfig.yml
|
||||||
// const exampleaddon = yaml.load(fs.readFileSync('./Addons/Settings/YourAddonConfig.yml', 'utf8'));
|
// const config = yaml.load(fs.readFileSync('./Addons/Configs/YourAddonConfig.yml', 'utf8'));
|
||||||
|
|
||||||
const Command = require("../Structures/Command.js");
|
const { Command, Event } = require("../Structures/Addon");
|
||||||
|
|
||||||
module.exports = new Command({
|
module.exports.commands = [
|
||||||
name: "hello",
|
/*
|
||||||
description: "hello",
|
// EXAMPLE COMMAND
|
||||||
slashCommandOptions: [],
|
new Command({
|
||||||
permission: "SEND_MESSAGES",
|
name: "hello",
|
||||||
|
description: "hello",
|
||||||
|
options: [],
|
||||||
|
permissions: ["SEND_MESSAGES"],
|
||||||
|
async run(interaction) {
|
||||||
|
const Embed = new Discord.MessageEmbed()
|
||||||
|
.setDescription("Hello World!")
|
||||||
|
.setColor(supportbot.InfoColour);
|
||||||
|
|
||||||
async run(interaction) {
|
interaction.reply({
|
||||||
const Embed = new Discord.MessageEmbed()
|
embeds: [Embed],
|
||||||
.setDescription("Hello World!")
|
});
|
||||||
.setColor(supportbot.InfoColour);
|
},
|
||||||
|
}),
|
||||||
interaction.reply({
|
*/
|
||||||
embeds: [Embed],
|
];
|
||||||
});
|
module.exports.events = [
|
||||||
},
|
/*
|
||||||
});
|
// EXAMPLE EVENT
|
||||||
|
new Event("ready", async (client) => {
|
||||||
|
console.log("Bot started!");
|
||||||
|
}),
|
||||||
|
*/
|
||||||
|
];
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
// 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("./Data/supportbot.yml", "utf8"));
|
|
||||||
const cmdconfig = yaml.load(fs.readFileSync("./Data/commands.yml", "utf8"));
|
|
||||||
|
|
||||||
const Command = require("../Structures/Command.js");
|
|
||||||
|
|
||||||
async function asyncForEach(array, callback) {
|
|
||||||
for (let index = 0; index < array.length; index++) {
|
|
||||||
await callback(array[index], index, array);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = new Command({
|
|
||||||
name: cmdconfig.TicketAdd,
|
|
||||||
description: cmdconfig.TicketAddDesc,
|
|
||||||
slashCommandOptions: [
|
|
||||||
{
|
|
||||||
name: "user",
|
|
||||||
description: "User to add",
|
|
||||||
type: "USER",
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
permission: "SEND_MESSAGES",
|
|
||||||
|
|
||||||
async run(interaction) {
|
|
||||||
let SupportStaff =
|
|
||||||
interaction.guild.roles.cache.find(
|
|
||||||
(SupportTeam) => SupportTeam.name === supportbot.Staff
|
|
||||||
) ||
|
|
||||||
interaction.guild.roles.cache.find(
|
|
||||||
(SupportTeam) => SupportTeam.id === supportbot.Staff
|
|
||||||
);
|
|
||||||
let Admins =
|
|
||||||
interaction.guild.roles.cache.find(
|
|
||||||
(AdminUser) => AdminUser.name === supportbot.Admin
|
|
||||||
) ||
|
|
||||||
interaction.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 (
|
|
||||||
interaction.member.roles.cache.has(SupportStaff.id) ||
|
|
||||||
interaction.member.roles.cache.has(Admins.id)
|
|
||||||
) {
|
|
||||||
if (
|
|
||||||
!interaction.channel.name.startsWith(`${supportbot.TicketChannel}-`)
|
|
||||||
) {
|
|
||||||
const Exists = new Discord.MessageEmbed()
|
|
||||||
.setTitle("No Ticket Found!")
|
|
||||||
.setDescription(`${supportbot.NoValidTicket}`)
|
|
||||||
.setColor(supportbot.WarningColour);
|
|
||||||
return interaction.reply({ 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] });
|
|
||||||
|
|
||||||
interaction.channel.permissionOverwrites.edit(uMember, {
|
|
||||||
VIEW_CHANNEL: true,
|
|
||||||
READ_MESSAGE_HISTORY: true,
|
|
||||||
SEND_MESSAGES: 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] });
|
|
||||||
} else {
|
|
||||||
return interaction.reply({ embeds: [NoPerms] });
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
// 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("./Data/supportbot.yml", "utf8"));
|
|
||||||
const cmdconfig = yaml.load(fs.readFileSync("./Data/commands.yml", "utf8"));
|
|
||||||
|
|
||||||
const Command = require("../Structures/Command.js");
|
|
||||||
|
|
||||||
async function asyncForEach(array, callback) {
|
|
||||||
for (let index = 0; index < array.length; index++) {
|
|
||||||
await callback(array[index], index, array);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = new Command({
|
|
||||||
name: cmdconfig.TicketRemove,
|
|
||||||
description: cmdconfig.TicketRemoveDesc,
|
|
||||||
slashCommandOptions: [
|
|
||||||
{
|
|
||||||
name: "user",
|
|
||||||
description: "User to remove",
|
|
||||||
type: "USER",
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
permission: "SEND_MESSAGES",
|
|
||||||
|
|
||||||
async run(interaction) {
|
|
||||||
let SupportStaff =
|
|
||||||
interaction.guild.roles.cache.find(
|
|
||||||
(SupportTeam) => SupportTeam.name === supportbot.Staff
|
|
||||||
) ||
|
|
||||||
interaction.guild.roles.cache.find(
|
|
||||||
(SupportTeam) => SupportTeam.id === supportbot.Staff
|
|
||||||
);
|
|
||||||
let Admins =
|
|
||||||
interaction.guild.roles.cache.find(
|
|
||||||
(AdminUser) => AdminUser.name === supportbot.Admin
|
|
||||||
) ||
|
|
||||||
interaction.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 (
|
|
||||||
interaction.member.roles.cache.has(SupportStaff.id) ||
|
|
||||||
interaction.member.roles.cache.has(Admins.id)
|
|
||||||
) {
|
|
||||||
if (
|
|
||||||
!interaction.channel.name.startsWith(`${supportbot.TicketChannel}-`)
|
|
||||||
) {
|
|
||||||
const Exists = new Discord.MessageEmbed()
|
|
||||||
.setTitle("No Ticket Found!")
|
|
||||||
.setDescription(`${supportbot.NoValidTicket}`)
|
|
||||||
.setColor(supportbot.WarningColour);
|
|
||||||
return interaction.reply({ 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({ embeds: [UserNotExist] });
|
|
||||||
|
|
||||||
interaction.channel.permissionOverwrites.edit(uMember, {
|
|
||||||
VIEW_CHANNEL: false,
|
|
||||||
READ_MESSAGE_HISTORY: false,
|
|
||||||
SEND_MESSAGES: 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] });
|
|
||||||
} else {
|
|
||||||
return interaction.reply({ embeds: [NoPerms] });
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
@@ -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);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -1,227 +0,0 @@
|
|||||||
// 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("./Data/supportbot.yml", "utf8"));
|
|
||||||
const cmdconfig = yaml.load(fs.readFileSync("./Data/commands.yml", "utf8"));
|
|
||||||
|
|
||||||
const Command = require("../Structures/Command.js");
|
|
||||||
const TicketNumberID = require("../Structures/TicketID.js");
|
|
||||||
|
|
||||||
async function asyncForEach(array, callback) {
|
|
||||||
for (let index = 0; index < array.length; index++) {
|
|
||||||
await callback(array[index], index, array);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = new Command({
|
|
||||||
name: cmdconfig.CloseTicket,
|
|
||||||
description: cmdconfig.CloseTicketDesc,
|
|
||||||
slashCommandOptions: [
|
|
||||||
{
|
|
||||||
name: "reason",
|
|
||||||
description: "Ticket Close Reason",
|
|
||||||
type: "STRING",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
permission: "SEND_MESSAGES",
|
|
||||||
|
|
||||||
async run(interaction) {
|
|
||||||
if (!interaction.channel.name.startsWith(`${supportbot.TicketChannel}-`)) {
|
|
||||||
const Exists = new Discord.MessageEmbed()
|
|
||||||
.setTitle("No Ticket Found!")
|
|
||||||
.setDescription(`${supportbot.NoValidTicket}`)
|
|
||||||
.setColor(supportbot.WarningColour);
|
|
||||||
return interaction.reply({ embed: Exists });
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
interaction
|
|
||||||
.reply(CloseTicketRequest)
|
|
||||||
.then((m) => {
|
|
||||||
interaction.channel
|
|
||||||
.awaitMessages(
|
|
||||||
(response) =>
|
|
||||||
response.content.toLowerCase() ===
|
|
||||||
supportbot.ClosingConfirmation_Word,
|
|
||||||
{
|
|
||||||
max: 1,
|
|
||||||
time: 20000,
|
|
||||||
errors: ["time"],
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.then((collected) => {
|
|
||||||
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 reason =
|
|
||||||
interaction.options.getString("reason") ||
|
|
||||||
"No Reason Provided.";
|
|
||||||
|
|
||||||
let name = interaction.channel.name;
|
|
||||||
let ticketChannel = interaction.channel;
|
|
||||||
|
|
||||||
interaction
|
|
||||||
.reply(`**${supportbot.ClosingTicket}**`)
|
|
||||||
|
|
||||||
.then(() => {
|
|
||||||
const logEmbed = new Discord.MessageEmbed()
|
|
||||||
.setTitle(supportbot.TranscriptTitle)
|
|
||||||
.setColor(supportbot.EmbedColour)
|
|
||||||
.setFooter(supportbot.EmbedFooter)
|
|
||||||
.addField("Closed By", interaction.user.tag)
|
|
||||||
.addField("Reason", reason);
|
|
||||||
|
|
||||||
interaction.channel.interactions
|
|
||||||
.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>`;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
logChannel.send({ embeds: [logEmbed] }).catch((err) => {
|
|
||||||
interaction.reply(err);
|
|
||||||
});
|
|
||||||
|
|
||||||
let file = new Discord.MessageAttachment(
|
|
||||||
Buffer.from(html),
|
|
||||||
`${name}.html`
|
|
||||||
);
|
|
||||||
logChannel
|
|
||||||
.send({ embeds: [logEmbed], files: [file] })
|
|
||||||
.catch((err) => {
|
|
||||||
interaction.reply(err);
|
|
||||||
});
|
|
||||||
|
|
||||||
interaction.channel.delete().catch((error) => {
|
|
||||||
if (
|
|
||||||
error.code !==
|
|
||||||
Discord.Constants.APIErrors.UNKNOWN_CHANNEL
|
|
||||||
) {
|
|
||||||
console.error(
|
|
||||||
"Failed to delete the interaction:",
|
|
||||||
error
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
interaction
|
|
||||||
.followUp({
|
|
||||||
content: "The request to close the ticket has timed out.",
|
|
||||||
})
|
|
||||||
.then((m2) => setTimeout(() => interaction.channel.delete(3000)));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!supportbot.CloseConfirmation) {
|
|
||||||
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 reason =
|
|
||||||
(await interaction.options.getString("reason")) ||
|
|
||||||
"No Reason Provided.";
|
|
||||||
|
|
||||||
let name = interaction.channel.name;
|
|
||||||
let ticketChannel = interaction.channel;
|
|
||||||
|
|
||||||
interaction
|
|
||||||
.reply(`**${supportbot.ClosingTicket}**`)
|
|
||||||
|
|
||||||
.then(() => {
|
|
||||||
const logEmbed = new Discord.MessageEmbed()
|
|
||||||
.setTitle(supportbot.TranscriptTitle)
|
|
||||||
.setColor(supportbot.EmbedColour)
|
|
||||||
.setFooter(supportbot.EmbedFooter)
|
|
||||||
.addField("Closed By", interaction.user.tag)
|
|
||||||
.addField("Reason", reason);
|
|
||||||
|
|
||||||
interaction.channel.interactions
|
|
||||||
.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>`;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
logChannel.send({ embeds: [logEmbed] }).catch((err) => {
|
|
||||||
interaction.reply(err);
|
|
||||||
});
|
|
||||||
|
|
||||||
let file = new Discord.MessageAttachment(
|
|
||||||
Buffer.from(html),
|
|
||||||
`${name}.html`
|
|
||||||
);
|
|
||||||
logChannel
|
|
||||||
.send({ embeds: [logEmbed], files: [file] })
|
|
||||||
.catch((err) => {
|
|
||||||
interaction.reply(err);
|
|
||||||
});
|
|
||||||
|
|
||||||
interaction.channel.delete().catch((error) => {
|
|
||||||
if (
|
|
||||||
error.code !== Discord.Constants.APIErrors.UNKNOWN_CHANNEL
|
|
||||||
) {
|
|
||||||
console.error("Failed to delete the interaction:", error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
interaction
|
|
||||||
.followUp({
|
|
||||||
content: "The request to close the ticket has timed out.",
|
|
||||||
})
|
|
||||||
.then((m2) => setTimeout(() => interaction.channel.delete(3000)));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
+71
-36
@@ -5,47 +5,77 @@ const fs = require("fs");
|
|||||||
|
|
||||||
const Discord = require("discord.js");
|
const Discord = require("discord.js");
|
||||||
const yaml = require("js-yaml");
|
const yaml = require("js-yaml");
|
||||||
const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
|
const supportbot = yaml.load(
|
||||||
const cmdconfig = yaml.load(fs.readFileSync("./Data/commands.yml", "utf8"));
|
fs.readFileSync("./Configs/supportbot.yml", "utf8")
|
||||||
|
);
|
||||||
|
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
|
||||||
|
|
||||||
const Command = require("../Structures/Command.js");
|
const Command = require("../Structures/Command.js");
|
||||||
|
|
||||||
module.exports = new Command({
|
module.exports = new Command({
|
||||||
name: cmdconfig.EmbedCommand,
|
name: cmdconfig.EmbedCommand,
|
||||||
description: cmdconfig.EmbedCommandDesc,
|
description: cmdconfig.EmbedCommandDesc,
|
||||||
slashCommandOptions: [
|
options: [
|
||||||
{
|
{
|
||||||
name: "title",
|
name: "title",
|
||||||
description: "Embed Title",
|
description: "Embed Title",
|
||||||
type: "STRING",
|
type: "STRING",
|
||||||
},
|
required: true,
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
name: "message",
|
name: "message",
|
||||||
description: "Embed Message",
|
description: "Embed Message",
|
||||||
type: "STRING",
|
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,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
permission: "SEND_MESSAGES",
|
permissions: ["SEND_MESSAGES"],
|
||||||
|
|
||||||
async run(interaction) {
|
async run(interaction) {
|
||||||
|
const { getRole } = interaction.client;
|
||||||
|
let SupportStaff = await getRole(supportbot.Staff, interaction.guild);
|
||||||
|
let Admin = await getRole(supportbot.Admin, interaction.guild);
|
||||||
|
|
||||||
let SupportStaff =
|
if (!SupportStaff || !Admin)
|
||||||
interaction.guild.roles.cache.find(
|
return interaction.reply(
|
||||||
(SupportTeam) => SupportTeam.name === supportbot.Staff
|
"Some roles seem to be missing!\nPlease check for errors when starting the bot."
|
||||||
) ||
|
|
||||||
interaction.guild.roles.cache.find(
|
|
||||||
(SupportTeam) => SupportTeam.id === supportbot.Staff
|
|
||||||
);
|
);
|
||||||
let Admins =
|
|
||||||
interaction.guild.roles.cache.find(
|
|
||||||
(AdminUser) => AdminUser.name === supportbot.Admin
|
|
||||||
) ||
|
|
||||||
interaction.guild.roles.cache.find(
|
|
||||||
(AdminUser) => AdminUser.id === supportbot.Admin
|
|
||||||
);
|
|
||||||
|
|
||||||
const NoPerms = new Discord.MessageEmbed()
|
const NoPerms = new Discord.MessageEmbed()
|
||||||
.setTitle("Invalid Permissions!")
|
.setTitle("Invalid Permissions!")
|
||||||
.setDescription(
|
.setDescription(
|
||||||
@@ -55,24 +85,29 @@ module.exports = new Command({
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
interaction.member.roles.cache.has(SupportStaff.id) ||
|
interaction.member.roles.cache.has(SupportStaff.id) ||
|
||||||
interaction.member.roles.cache.has(Admins.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 EmbedTitle = interaction.options.getString("title")
|
const EmbedMsg = new Discord.MessageEmbed()
|
||||||
const EmbedSubject = interaction.options.getString("message")
|
.setTitle(EmbedTitle)
|
||||||
|
.setDescription(EmbedSubject)
|
||||||
const EmbedMsg = new Discord.MessageEmbed()
|
.addField(EmbedFieldTitle, EmbedFieldContent)
|
||||||
.setTitle(EmbedTitle)
|
.setColor(EmbedColour)
|
||||||
.setDescription(EmbedSubject)
|
.setThumbnail(EmbedThumbnail)
|
||||||
|
.setImage(EmbedImage);
|
||||||
interaction.reply({
|
|
||||||
embeds: [EmbedMsg],
|
|
||||||
});
|
|
||||||
|
|
||||||
|
interaction.reply({
|
||||||
|
embeds: [EmbedMsg],
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
return interaction.reply({ embeds: [NoPerms] });
|
return interaction.reply({ embeds: [NoPerms] });
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
});
|
});
|
||||||
+68
-83
@@ -5,100 +5,85 @@ const fs = require("fs");
|
|||||||
|
|
||||||
const Discord = require("discord.js");
|
const Discord = require("discord.js");
|
||||||
const yaml = require("js-yaml");
|
const yaml = require("js-yaml");
|
||||||
const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
|
const supportbot = yaml.load(
|
||||||
const cmdconfig = yaml.load(fs.readFileSync("./Data/commands.yml", "utf8"));
|
fs.readFileSync("./Configs/supportbot.yml", "utf8")
|
||||||
|
);
|
||||||
|
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
|
||||||
|
|
||||||
const Command = require("../Structures/Command.js");
|
const Command = require("../Structures/Command.js");
|
||||||
|
|
||||||
async function asyncForEach(array, callback) {
|
|
||||||
for (let index = 0; index < array.length; index++) {
|
|
||||||
await callback(array[index], index, array);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = new Command({
|
module.exports = new Command({
|
||||||
name: cmdconfig.HelpCommand,
|
name: cmdconfig.HelpCommand,
|
||||||
description: cmdconfig.HelpCommandDesc,
|
description: cmdconfig.HelpCommandDesc,
|
||||||
slashCommandOptions: [],
|
options: [],
|
||||||
permission: "SEND_MESSAGES",
|
permissions: ["SEND_MESSAGES"],
|
||||||
|
|
||||||
async run(interaction) {
|
async run(interaction) {
|
||||||
let SupportStaff =
|
const { getRole } = interaction.client;
|
||||||
interaction.guild.roles.cache.find(
|
let SupportStaff = await getRole(supportbot.Staff, interaction.guild);
|
||||||
(adminRole) => adminRole.name === supportbot.Staff
|
let Admin = await getRole(supportbot.Admin, interaction.guild);
|
||||||
) ||
|
if (!SupportStaff || !Admin)
|
||||||
interaction.guild.roles.cache.find(
|
return interaction.reply(
|
||||||
(staffRole) => staffRole.id === supportbot.Staff
|
"Some roles seem to be missing!\nPlease check for errors when starting the bot."
|
||||||
);
|
|
||||||
let AdminStaff =
|
|
||||||
interaction.guild.roles.cache.find(
|
|
||||||
(adminRole) => adminRole.name === supportbot.Admin
|
|
||||||
) ||
|
|
||||||
interaction.guild.roles.cache.find(
|
|
||||||
(adminRole) => adminRole.id === supportbot.Admin
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (supportbot.HelpMenu) {
|
let botCommands = "";
|
||||||
let botCommands = "";
|
botCommands += `**/${cmdconfig.HelpCommand}** ${cmdconfig.HelpCommandDesc}\n`;
|
||||||
botCommands += `**/${cmdconfig.HelpCommand}** ${cmdconfig.HelpCommandDesc}\n`;
|
botCommands += `**/${cmdconfig.InfoCommand}** ${cmdconfig.InfoCommandDesc}\n`;
|
||||||
botCommands += `**/${cmdconfig.InfoCommand}** ${cmdconfig.InfoCommandDesc}\n`;
|
botCommands += `**/${cmdconfig.PingCommand}** ${cmdconfig.PingCommandDesc}\n`;
|
||||||
botCommands += `**/${cmdconfig.PingCommand}** ${cmdconfig.PingCommandDesc}\n`;
|
botCommands += `**/${cmdconfig.UserInfoCommand}** ${cmdconfig.UserInfoCommandDesc}\n`;
|
||||||
|
|
||||||
let ticketCommands = "";
|
if (supportbot.DisableSuggestions === false) {
|
||||||
ticketCommands += `**/${cmdconfig.OpenTicket}** ${cmdconfig.OpenTicketDesc}\n`;
|
botCommands += `**/${cmdconfig.SuggestCommand}** ${cmdconfig.SuggestCommandDesc}\n`;
|
||||||
ticketCommands += `**/${cmdconfig.CloseTicket}** ${cmdconfig.CloseTicketDesc}\n`;
|
|
||||||
|
|
||||||
let staffCommands = "";
|
|
||||||
staffCommands += `**/${cmdconfig.TicketAdd}** ${cmdconfig.TicketAddDesc}\n`;
|
|
||||||
staffCommands += `**/${cmdconfig.TicketRemove}** ${cmdconfig.TicketRemoveDesc}\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(supportbot.EmbedFooter, interaction.user.displayAvatarURL());
|
|
||||||
|
|
||||||
if (interaction.member.roles.cache.has(SupportStaff.id)) {
|
|
||||||
HelpEmbed1.addFields({
|
|
||||||
name: "🔐 Staff Commands\n",
|
|
||||||
value: `${staffCommands}\n`,
|
|
||||||
inline: false,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
if (interaction.member.roles.cache.has(AdminStaff.id)) {
|
|
||||||
HelpEmbed1.addFields({
|
|
||||||
name: "🔐 Staff Commands\n",
|
|
||||||
value: `${staffCommands}\n`,
|
|
||||||
inline: false,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (supportbot.SendHelpPage === "dm") {
|
|
||||||
interaction.user.reply({
|
|
||||||
embeds: [HelpEmbed1],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (supportbot.SendHelpPage === "channel") {
|
|
||||||
interaction.reply({
|
|
||||||
embeds: [HelpEmbed1],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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],
|
||||||
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
+6
-4
@@ -5,16 +5,18 @@ const fs = require("fs");
|
|||||||
|
|
||||||
const Discord = require("discord.js");
|
const Discord = require("discord.js");
|
||||||
const yaml = require("js-yaml");
|
const yaml = require("js-yaml");
|
||||||
const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
|
const supportbot = yaml.load(
|
||||||
const cmdconfig = yaml.load(fs.readFileSync("./Data/commands.yml", "utf8"));
|
fs.readFileSync("./Configs/supportbot.yml", "utf8")
|
||||||
|
);
|
||||||
|
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
|
||||||
|
|
||||||
const Command = require("../Structures/Command.js");
|
const Command = require("../Structures/Command.js");
|
||||||
|
|
||||||
module.exports = new Command({
|
module.exports = new Command({
|
||||||
name: cmdconfig.InfoCommand,
|
name: cmdconfig.InfoCommand,
|
||||||
description: cmdconfig.InfoCommandDesc,
|
description: cmdconfig.InfoCommandDesc,
|
||||||
slashCommandOptions: [],
|
options: [],
|
||||||
permission: "SEND_MESSAGES",
|
permissions: ["SEND_MESSAGES"],
|
||||||
|
|
||||||
async run(interaction) {
|
async run(interaction) {
|
||||||
const InfoButton = new Discord.MessageButton()
|
const InfoButton = new Discord.MessageButton()
|
||||||
|
|||||||
+6
-4
@@ -5,16 +5,18 @@ const fs = require("fs");
|
|||||||
|
|
||||||
const Discord = require("discord.js");
|
const Discord = require("discord.js");
|
||||||
const yaml = require("js-yaml");
|
const yaml = require("js-yaml");
|
||||||
const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
|
const supportbot = yaml.load(
|
||||||
const cmdconfig = yaml.load(fs.readFileSync("./Data/commands.yml", "utf8"));
|
fs.readFileSync("./Configs/supportbot.yml", "utf8")
|
||||||
|
);
|
||||||
|
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
|
||||||
|
|
||||||
const Command = require("../Structures/Command.js");
|
const Command = require("../Structures/Command.js");
|
||||||
|
|
||||||
module.exports = new Command({
|
module.exports = new Command({
|
||||||
name: cmdconfig.PingCommand,
|
name: cmdconfig.PingCommand,
|
||||||
description: cmdconfig.PingCommandDesc,
|
description: cmdconfig.PingCommandDesc,
|
||||||
slashCommandOptions: [],
|
options: [],
|
||||||
permission: "SEND_MESSAGES",
|
permissions: ["SEND_MESSAGES"],
|
||||||
|
|
||||||
async run(interaction) {
|
async run(interaction) {
|
||||||
const PingEmbed = new Discord.MessageEmbed()
|
const PingEmbed = new Discord.MessageEmbed()
|
||||||
|
|||||||
@@ -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
|
||||||
|
// 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.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]
|
||||||
|
})
|
||||||
|
|
||||||
|
},
|
||||||
|
});
|
||||||
+229
-260
@@ -3,176 +3,173 @@
|
|||||||
|
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
|
|
||||||
const Discord = require("discord.js");
|
const {
|
||||||
|
MessageEmbed,
|
||||||
|
Permissions,
|
||||||
|
MessageButton,
|
||||||
|
MessageActionRow,
|
||||||
|
} = require("discord.js");
|
||||||
const yaml = require("js-yaml");
|
const yaml = require("js-yaml");
|
||||||
const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
|
const supportbot = yaml.load(
|
||||||
const cmdconfig = yaml.load(fs.readFileSync("./Data/commands.yml", "utf8"));
|
fs.readFileSync("./Configs/supportbot.yml", "utf8")
|
||||||
|
);
|
||||||
|
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
|
||||||
|
|
||||||
const Command = require("../Structures/Command.js");
|
const Command = require("../Structures/Command.js");
|
||||||
const TicketNumberID = require("../Structures/TicketID.js");
|
const TicketNumberID = require("../Structures/TicketID.js");
|
||||||
|
|
||||||
async function asyncForEach(array, callback) {
|
|
||||||
for (let index = 0; index < array.length; index++) {
|
|
||||||
await callback(array[index], index, array);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = new Command({
|
module.exports = new Command({
|
||||||
name: cmdconfig.OpenTicket,
|
name: cmdconfig.OpenTicket,
|
||||||
description: cmdconfig.OpenTicketDesc,
|
description: cmdconfig.OpenTicketDesc,
|
||||||
slashCommandOptions: [
|
options: [
|
||||||
{
|
{
|
||||||
name: "reason",
|
name: "reason",
|
||||||
description: "Ticket Reason",
|
description: "Ticket Reason",
|
||||||
type: "STRING",
|
type: "STRING",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
permission: "SEND_MESSAGES",
|
permissions: ["SEND_MESSAGES"],
|
||||||
|
|
||||||
async run(interaction) {
|
async run(interaction) {
|
||||||
let reactionUser = interaction.guild.members.cache.get(interaction.user.id);
|
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 (
|
if (
|
||||||
reactionUser.roles.cache.find(
|
supportbot.MaxAllowedTickets &&
|
||||||
(role) => role.name === supportbot.TicketBlackListRole
|
TicketData.tickets.filter((t) => t.user === interaction.user.id && t.open)
|
||||||
) ||
|
.length >= supportbot.MaxAllowedTickets
|
||||||
reactionUser.roles.cache.find(
|
) {
|
||||||
(role) => role.id === supportbot.TicketBlackListRole
|
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
|
return interaction.reply({
|
||||||
.reply({
|
content: supportbot.TicketBlackListMessage,
|
||||||
content: `<@${interaction.user.id}> ${supportbot.TicketBlackListMessage}`,
|
ephemeral: true,
|
||||||
})
|
});
|
||||||
.then((msg) => {
|
|
||||||
setTimeout(() => msg.delete(), 3500);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ticket ID
|
// Ticket ID
|
||||||
let ticketNumberID = TicketNumberID.pad(interaction.guild.id);
|
let ticketNumberID = await TicketNumberID.pad();
|
||||||
|
|
||||||
// Ticket Subject
|
// Ticket Subject
|
||||||
const TicketSubject =
|
const TicketSubject =
|
||||||
interaction.options?.getString("reason") || supportbot.NoTicketSubject;
|
interaction.options?.getString("reason") || supportbot.NoTicketSubject;
|
||||||
|
|
||||||
const TicketExists = new Discord.MessageEmbed()
|
const TicketExists = new MessageEmbed()
|
||||||
.setTitle("Ticket Exists!")
|
.setTitle("Ticket Exists!")
|
||||||
.setDescription(`${supportbot.TicketExists}`)
|
.setDescription(supportbot.TicketExists);
|
||||||
.setColor(supportbot.WarningColour);
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
interaction.guild.channels.cache.find(
|
await interaction.guild.channels.cache.find(
|
||||||
(ticketChannel) =>
|
(ticketChannel) =>
|
||||||
ticketChannel.name === `${supportbot.TicketChannel}-${ticketNumberID}`
|
ticketChannel.name === `${supportbot.TicketPrefix}${ticketNumberID}`
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
return interaction.reply({ embeds: [TicketExists] });
|
return await interaction.reply({
|
||||||
|
embeds: [TicketExists],
|
||||||
|
ephemeral: true,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
const Staff =
|
const Staff = await getRole(supportbot.Staff, interaction.guild);
|
||||||
interaction.guild.roles.cache.find(
|
const Admin = await getRole(supportbot.Admin, interaction.guild);
|
||||||
(SupportTeam) => SupportTeam.name === supportbot.Staff
|
if (!Staff || !Admin)
|
||||||
) ||
|
return interaction.reply({
|
||||||
interaction.guild.roles.cache.find(
|
content:
|
||||||
(SupportTeam) => SupportTeam.id === supportbot.Staff
|
"Some roles seem to be missing!\nPlease check for errors when starting the bot.",
|
||||||
);
|
ephemeral: true,
|
||||||
const Admins =
|
});
|
||||||
interaction.guild.roles.cache.find(
|
let TicketCategory = await getCategory(
|
||||||
(AdminUser) => AdminUser.name === supportbot.Admin
|
supportbot.Departments[department].category || supportbot.TicketCategory,
|
||||||
) ||
|
interaction.guild
|
||||||
interaction.guild.roles.cache.find(
|
);
|
||||||
(AdminUser) => AdminUser.id === supportbot.Admin
|
|
||||||
);
|
|
||||||
const DeptRole1 =
|
|
||||||
interaction.guild.roles.cache.find(
|
|
||||||
(DepartmentRole) =>
|
|
||||||
DepartmentRole.name === `${supportbot.DepartmentRole_1}`
|
|
||||||
) ||
|
|
||||||
interaction.guild.roles.cache.find(
|
|
||||||
(DepartmentRole) =>
|
|
||||||
DepartmentRole.id === `${supportbot.DepartmentRole_1}`
|
|
||||||
);
|
|
||||||
const DeptRole2 =
|
|
||||||
interaction.guild.roles.cache.find(
|
|
||||||
(DepartmentRole) =>
|
|
||||||
DepartmentRole.name === `${supportbot.DepartmentRole_2}`
|
|
||||||
) ||
|
|
||||||
interaction.guild.roles.cache.find(
|
|
||||||
(DepartmentRole) =>
|
|
||||||
DepartmentRole.id === `${supportbot.DepartmentRole_2}`
|
|
||||||
);
|
|
||||||
const DeptRole3 =
|
|
||||||
interaction.guild.roles.cache.find(
|
|
||||||
(DepartmentRole) =>
|
|
||||||
DepartmentRole.name === `${supportbot.DepartmentRole_3}`
|
|
||||||
) ||
|
|
||||||
interaction.guild.roles.cache.find(
|
|
||||||
(DepartmentRole) =>
|
|
||||||
DepartmentRole.id === `${supportbot.DepartmentRole_3}`
|
|
||||||
);
|
|
||||||
const Author = interaction.user;
|
|
||||||
const Everyone = interaction.guild.id;
|
|
||||||
const ticketChannel = await interaction.guild.channels.create(
|
const ticketChannel = await interaction.guild.channels.create(
|
||||||
`${supportbot.TicketChannel}-${ticketNumberID}`,
|
`${supportbot.TicketPrefix}${ticketNumberID}`,
|
||||||
{
|
{
|
||||||
type: "GUILD_TEXT",
|
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 (supportbot.TicketDepartments && !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);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
if (
|
const CreatedTicket = new MessageEmbed()
|
||||||
interaction.channel.name === supportbot.ReactionChannel ||
|
.setDescription(
|
||||||
interaction.channel.id === supportbot.ReactionChannel
|
supportbot.TicketCreatedAlert.replace(
|
||||||
) {
|
/%ticketauthor%/g,
|
||||||
const CreatedTicket = new Discord.MessageEmbed()
|
interaction.user.id
|
||||||
.setDescription(
|
|
||||||
supportbot.TicketCreatedAlert.replace(
|
|
||||||
/%ticketauthor%/g,
|
|
||||||
interaction.user.id
|
|
||||||
)
|
|
||||||
.replace(/%ticketid%/g, ticketChannel.id)
|
|
||||||
.replace(/%ticketusername%/g, interaction.user.username)
|
|
||||||
)
|
)
|
||||||
.setColor(supportbot.EmbedColour);
|
.replace(/%ticketid%/g, ticketChannel.id)
|
||||||
interaction.reply({ embeds: [CreatedTicket], ephemeral: true });
|
.replace(/%ticketusername%/g, interaction.user.username)
|
||||||
} else {
|
)
|
||||||
const CreatedTicket = new Discord.MessageEmbed()
|
.setColor(supportbot.EmbedColour);
|
||||||
.setDescription(
|
await interaction.reply({ embeds: [CreatedTicket], ephemeral: true });
|
||||||
supportbot.TicketCreatedAlert.replace(
|
|
||||||
/%ticketauthor%/g,
|
|
||||||
interaction.user.id
|
|
||||||
)
|
|
||||||
.replace(/%ticketid%/g, ticketChannel.id)
|
|
||||||
.replace(/%ticketusername%/g, interaction.user.username)
|
|
||||||
)
|
|
||||||
.setColor(supportbot.EmbedColour);
|
|
||||||
interaction.reply({ embeds: [CreatedTicket], ephemeral: true });
|
|
||||||
}
|
|
||||||
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 =
|
|
||||||
interaction.guild.channels.cache.find(
|
|
||||||
(category) => category.name === supportbot.TicketCategory
|
|
||||||
) ||
|
|
||||||
interaction.guild.channels.cache.find(
|
|
||||||
(category) => category.id === supportbot.TicketCategory
|
|
||||||
);
|
|
||||||
if (TicketCategory) {
|
|
||||||
ticketChannel.setParent(TicketCategory.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (supportbot.AllowTicketMentions) {
|
if (supportbot.AllowTicketMentions) {
|
||||||
ticketChannel.send({ content: `${interaction.user}` });
|
await ticketChannel.send(`${interaction.user}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const TicketMessage = new Discord.MessageEmbed()
|
const TicketMessage = new MessageEmbed()
|
||||||
.setTitle(
|
.setTitle(
|
||||||
supportbot.Ticket_Title.replace(/%ticketauthor%/g, interaction.user.id)
|
supportbot.Ticket_Title.replace(/%ticketauthor%/g, interaction.user.id)
|
||||||
.replace(/%ticketid%/g, ticketChannel.id)
|
.replace(/%ticketid%/g, ticketChannel.id)
|
||||||
@@ -186,176 +183,148 @@ module.exports = new Command({
|
|||||||
.setColor(supportbot.EmbedColour);
|
.setColor(supportbot.EmbedColour);
|
||||||
|
|
||||||
if (supportbot.TicketSubject === "embed") {
|
if (supportbot.TicketSubject === "embed") {
|
||||||
if (TicketSubject != "No Reason Provided.") {
|
if (TicketSubject !== "No Reason Provided.") {
|
||||||
TicketMessage.addFields({ name: "Reason", value: TicketSubject });
|
TicketMessage.addFields({ name: "Reason", value: TicketSubject });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (supportbot.TicketSubject === "description") {
|
if (supportbot.TicketSubject === "description") {
|
||||||
if (TicketSubject != "No Reason Provided.") {
|
if (TicketSubject !== "No Reason Provided.") {
|
||||||
ticketChannel.setTopic(
|
await ticketChannel.setTopic(
|
||||||
`Reason: ${TicketSubject} - User ID: ${interaction.user.id} - Ticket: ${ticketChannel.name}`
|
`Reason: ${TicketSubject} - User ID: ${interaction.user.id} - Ticket: ${ticketChannel.name}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (supportbot.TicketDepartments) {
|
if (supportbot.TicketDepartments && !department) {
|
||||||
TicketMessage.addFields({
|
TicketMessage.addFields({
|
||||||
name: "Departments",
|
name: "Departments",
|
||||||
value: ` **${supportbot.DepartmentTitle_1}**\n **${supportbot.DepartmentTitle_2}**\n **${supportbot.DepartmentTitle_3}**`,
|
value: ` **${supportbot.Departments.map((X) => X.title).join("\n")}**`,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const CloseButton = new Discord.MessageButton()
|
const CloseButton = new MessageButton()
|
||||||
.setCustomId("ticketclose")
|
.setCustomId("ticketclose")
|
||||||
.setLabel("Close")
|
.setLabel("Close")
|
||||||
.setStyle(supportbot.TicketCloseColour)
|
.setStyle(supportbot.TicketCloseColour)
|
||||||
.setEmoji(supportbot.TicketCloseEmoji);
|
.setEmoji(supportbot.TicketCloseEmoji);
|
||||||
|
|
||||||
const LockButton = new Discord.MessageButton()
|
const LockButton = new MessageButton()
|
||||||
.setCustomId("ticketlock")
|
.setCustomId("ticketlock")
|
||||||
.setLabel("Lock")
|
.setLabel("Lock")
|
||||||
.setStyle(supportbot.TicketLockColour)
|
.setStyle(supportbot.TicketLockColour)
|
||||||
.setEmoji(supportbot.TicketLockEmoji);
|
.setEmoji(supportbot.TicketLockEmoji);
|
||||||
|
|
||||||
const row2 = new Discord.MessageActionRow().addComponents(
|
const row2 = new MessageActionRow().addComponents(CloseButton, LockButton);
|
||||||
CloseButton,
|
if (supportbot.TicketDepartments && !department) {
|
||||||
LockButton
|
try {
|
||||||
);
|
let buttons = await supportbot.Departments.map((x) =>
|
||||||
|
new MessageButton()
|
||||||
if (supportbot.TicketDepartments) {
|
.setCustomId("Department" + supportbot.Departments.indexOf(x))
|
||||||
let DenyArr = [DeptRole1, DeptRole2, DeptRole3];
|
.setLabel(x.title)
|
||||||
await asyncForEach(DenyArr, (index) => {
|
.setStyle(x.color)
|
||||||
ticketChannel.permissionOverwrites.create(index, {
|
.setEmoji(x.emoji)
|
||||||
VIEW_CHANNEL: false,
|
);
|
||||||
|
const row = new MessageActionRow().addComponents(buttons);
|
||||||
|
const m = await ticketChannel.send({
|
||||||
|
embeds: [TicketMessage],
|
||||||
|
components: [row],
|
||||||
});
|
});
|
||||||
});
|
|
||||||
const Department1Button = new Discord.MessageButton()
|
|
||||||
.setCustomId("Department1")
|
|
||||||
.setLabel(`${supportbot.DepartmentTitle_1}`)
|
|
||||||
.setStyle(supportbot.TicketDept1Colour)
|
|
||||||
.setEmoji(supportbot.TicketDept1Emoji);
|
|
||||||
|
|
||||||
const Department2Button = new Discord.MessageButton()
|
let collector;
|
||||||
.setCustomId("Department2")
|
try {
|
||||||
.setLabel(`${supportbot.DepartmentTitle_2}`)
|
const filter = (i) => i.user.id === interaction.user.id;
|
||||||
.setStyle(supportbot.TicketDept2Colour)
|
collector = await m.awaitMessageComponent({
|
||||||
.setEmoji(supportbot.TicketDept2Emoji);
|
filter,
|
||||||
|
max: 1,
|
||||||
const Department3Button = new Discord.MessageButton()
|
componentType: "BUTTON",
|
||||||
.setCustomId("Department3")
|
time: supportbot.Timeout * 60000,
|
||||||
.setLabel(`${supportbot.DepartmentTitle_3}`)
|
|
||||||
.setStyle(supportbot.TicketDept3Colour)
|
|
||||||
.setEmoji(supportbot.TicketDept3Emoji);
|
|
||||||
|
|
||||||
const row = new Discord.MessageActionRow().addComponents(
|
|
||||||
Department1Button,
|
|
||||||
Department2Button,
|
|
||||||
Department3Button
|
|
||||||
);
|
|
||||||
|
|
||||||
const m = await ticketChannel.send({
|
|
||||||
embeds: [TicketMessage],
|
|
||||||
components: [row],
|
|
||||||
});
|
|
||||||
|
|
||||||
const filter = (i) => {
|
|
||||||
i.deferUpdate();
|
|
||||||
return i.user.id === interaction.user.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,
|
|
||||||
});
|
});
|
||||||
|
} catch (e) {
|
||||||
if (!supportbot.AllowStaff) {
|
if (e.code === "INTERACTION_COLLECTOR_ERROR") {
|
||||||
ticketChannel.permissionOverwrites.edit(Staff, {
|
try {
|
||||||
VIEW_CHANNEL: false,
|
TicketData = await JSON.parse(
|
||||||
READ_MESSAGE_HISTORY: false,
|
fs.readFileSync("./Data/TicketData.json", "utf8")
|
||||||
SEND_MESSAGES: false,
|
);
|
||||||
});
|
let ticket = await TicketData.tickets.findIndex(
|
||||||
}
|
(t) => t.id === ticketChannel.id
|
||||||
|
);
|
||||||
const Department1 = new Discord.MessageEmbed()
|
TicketData.tickets[ticket].open = false;
|
||||||
.setDescription(
|
fs.writeFileSync(
|
||||||
`> Thank for reaching out to the **${supportbot.DepartmentTitle_1} Department**. Please provide us information regarding your query.`
|
"./Data/TicketData.json",
|
||||||
)
|
JSON.stringify(TicketData, null, 4),
|
||||||
.setColor(supportbot.EmbedColour);
|
(err) => {
|
||||||
ticketChannel.send({ embeds: [Department1] });
|
if (err) console.error(err);
|
||||||
|
}
|
||||||
if (supportbot.AllowTicketMentions) {
|
);
|
||||||
ticketChannel.send({ content: `@here` });
|
interaction.user.send(
|
||||||
|
"Your ticket has timed out. Please open a new one, and select a department."
|
||||||
|
);
|
||||||
|
} catch (e) {}
|
||||||
|
return await ticketChannel.delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
i.message.edit({ embeds: [TicketMessage], components: [row2] });
|
let num = collector.customId.split("Department")[1];
|
||||||
|
let role = getRole(supportbot.Departments[num].role, interaction.guild);
|
||||||
|
let title = supportbot.Departments[num].title;
|
||||||
|
|
||||||
if (i.customId === "Department2") {
|
await ticketChannel.permissionOverwrites.edit(role.id, {
|
||||||
ticketChannel.permissionOverwrites.edit(DeptRole2, {
|
VIEW_CHANNEL: true,
|
||||||
VIEW_CHANNEL: true,
|
});
|
||||||
READ_MESSAGE_HISTORY: true,
|
await ticketChannel.permissionOverwrites.edit(interaction.user.id, {
|
||||||
SEND_MESSAGES: true,
|
SEND_MESSAGES: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!supportbot.AllowStaff) {
|
await collector.reply({
|
||||||
ticketChannel.permissionOverwrites.edit(Staff, {
|
embeds: [
|
||||||
VIEW_CHANNEL: false,
|
{
|
||||||
READ_MESSAGE_HISTORY: false,
|
description: `> Thank for reaching out to the **${title} Department**. Please provide us information regarding your query.`,
|
||||||
SEND_MESSAGES: false,
|
color: supportbot.EmbedColour,
|
||||||
});
|
},
|
||||||
}
|
],
|
||||||
|
});
|
||||||
|
|
||||||
const Department2 = new Discord.MessageEmbed()
|
if (supportbot.AllowTicketMentions) {
|
||||||
.setDescription(
|
await ticketChannel.send("@here");
|
||||||
`> 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") {
|
await collector.message.edit({
|
||||||
ticketChannel.permissionOverwrites.edit(DeptRole3, {
|
embeds: [TicketMessage],
|
||||||
VIEW_CHANNEL: true,
|
components: [row2],
|
||||||
READ_MESSAGE_HISTORY: true,
|
});
|
||||||
SEND_MESSAGES: true,
|
} catch (error) {}
|
||||||
});
|
|
||||||
|
|
||||||
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 {
|
} else {
|
||||||
ticketChannel.send({ embeds: [TicketMessage], components: [row2] });
|
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 ||
|
||||||
|
supportbot.TicketCategory,
|
||||||
|
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("@here");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
// 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");
|
||||||
|
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/
|
||||||
|
**/
|
||||||
@@ -7,13 +7,14 @@
|
|||||||
# SupportBot created by Emerald Services
|
# SupportBot created by Emerald Services
|
||||||
# Installed with MIT License
|
# Installed with MIT License
|
||||||
#
|
#
|
||||||
# Discord Support: https:#emeraldsrv.dev/discord
|
# Discord Support: https://emeraldsrv.dev/discord
|
||||||
# Community Resources: https:#emeraldsrv.dev/resources
|
# Community Resources: https://emeraldsrv.dev/resources
|
||||||
|
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
# Command Name Configuration
|
# Command Name Configuration
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
|
|
||||||
|
Blacklist: "blacklist"
|
||||||
TicketAdd: "add"
|
TicketAdd: "add"
|
||||||
TicketRemove: "remove"
|
TicketRemove: "remove"
|
||||||
OpenTicket: "ticket"
|
OpenTicket: "ticket"
|
||||||
@@ -22,18 +23,23 @@ InfoCommand: "info"
|
|||||||
PingCommand: "ping"
|
PingCommand: "ping"
|
||||||
HelpCommand: "help"
|
HelpCommand: "help"
|
||||||
EmbedCommand: "embed"
|
EmbedCommand: "embed"
|
||||||
|
SuggestCommand: "suggestion"
|
||||||
|
TranslateCommand: "translate"
|
||||||
|
UserInfoCommand: "userinfo"
|
||||||
|
|
||||||
# ---------------------------------------
|
# ---------------------------------------
|
||||||
# Command Description Configuration
|
# Command Description Configuration
|
||||||
# ---------------------------------------
|
# ---------------------------------------
|
||||||
|
|
||||||
|
BlacklistDesc: "Blacklist a user from creating Tickets."
|
||||||
TicketAddDesc: "Add a user to a support ticket."
|
TicketAddDesc: "Add a user to a support ticket."
|
||||||
TicketRemoveDesc: "Remove a user from 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."
|
OpenTicketDesc: "Open a new support ticket."
|
||||||
CloseTicketDesc: "Close your support ticket."
|
CloseTicketDesc: "Close your support ticket."
|
||||||
InfoCommandDesc: "Get information about the brand."
|
InfoCommandDesc: "Get information about the brand."
|
||||||
PingCommandDesc: "Pong!"
|
PingCommandDesc: "Pong!"
|
||||||
HelpCommandDesc: "Get a list of all the commands."
|
HelpCommandDesc: "Get a list of all the commands."
|
||||||
EmbedCommandDesc: "Send a message as an embed."
|
EmbedCommandDesc: "Send a message as an embed."
|
||||||
|
SuggestCommandDesc: "Suggest a feature for the server."
|
||||||
|
UserInfoCommandDesc: "Get info about a user."
|
||||||
@@ -7,18 +7,17 @@
|
|||||||
# SupportBot created by Emerald Services
|
# SupportBot created by Emerald Services
|
||||||
# Installed with MIT License
|
# Installed with MIT License
|
||||||
#
|
#
|
||||||
# Discord Support: https:#emeraldsrv.dev/discord
|
# Discord Support: https://emeraldsrv.dev/discord
|
||||||
# Community Resources: https:#emeraldsrv.dev/resources
|
# Community Resources: https://emeraldsrv.dev/resources
|
||||||
|
|
||||||
SupportBot_Version: "7.2 pre-3"
|
SupportBot_Version: "7.7 BETA-v2"
|
||||||
|
|
||||||
# -------------------------
|
# -------------------------
|
||||||
# General Configuration
|
# General Configuration
|
||||||
# -------------------------
|
# -------------------------
|
||||||
|
|
||||||
Name: "SupportBot"
|
Name: "SupportBot"
|
||||||
Prefix: "!" # Everything uses the new Slash (/) Commands feature!
|
Token: "BOT_TOKEN_HERE"
|
||||||
Token: "BOT_TOKEN"
|
|
||||||
|
|
||||||
# -------------------------
|
# -------------------------
|
||||||
# Activity Configuration
|
# Activity Configuration
|
||||||
@@ -54,46 +53,108 @@ InfoButtonText: "Visit Site"
|
|||||||
InfoURL: "https://emeraldsrv.dev"
|
InfoURL: "https://emeraldsrv.dev"
|
||||||
InfoColour: "#f74343"
|
InfoColour: "#f74343"
|
||||||
|
|
||||||
# -------------------------
|
|
||||||
# Help Configuration
|
|
||||||
# -------------------------
|
|
||||||
|
|
||||||
HelpMenu: true # Do not change!
|
|
||||||
SendHelpPage: "channel" # Set to channel or dm
|
|
||||||
|
|
||||||
# -------------------------
|
# -------------------------
|
||||||
# Role Configuration
|
# Role Configuration
|
||||||
# -------------------------
|
# -------------------------
|
||||||
|
|
||||||
AutoRole: true
|
AutoRole: true
|
||||||
AutoRole_Role: "Member"
|
JoinRole: "Member"
|
||||||
LockdownRole: "@everyone"
|
|
||||||
|
|
||||||
Staff: "Support Team"
|
Staff: "Staff"
|
||||||
Admin: "Project Developer"
|
Admin: "Admin"
|
||||||
TicketBlackListRole: "Blacklisted"
|
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
|
||||||
|
|
||||||
|
|
||||||
|
# ----------------------------
|
||||||
|
# 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 suggestiosn feature.
|
||||||
|
|
||||||
|
# -------------------------
|
||||||
|
# Translate Configuration
|
||||||
|
# -------------------------
|
||||||
|
|
||||||
|
TranslateLogChannel: "translations-log"
|
||||||
|
|
||||||
# -------------------------
|
# -------------------------
|
||||||
# Tickets Configuration
|
# Tickets Configuration
|
||||||
# -------------------------
|
# -------------------------
|
||||||
|
|
||||||
TicketCategory: "▬▬ TICKETS ▬▬"
|
TicketCategory: "Tickets" # Only for tickets without a category
|
||||||
TicketChannel: "ticket"
|
TicketPrefix: "ticket-" # The prefix for ticket channel names
|
||||||
|
|
||||||
TicketLog: "ticket-log"
|
TicketLog: "ticket-data"
|
||||||
TranscriptLog: "ticket-data"
|
TranscriptLog: "ticket-data"
|
||||||
|
|
||||||
|
DMTranscripts: true
|
||||||
TranscriptTitle: "Ticket Transcript"
|
TranscriptTitle: "Ticket Transcript"
|
||||||
TicketLog_Title: "Ticket Log"
|
TicketLog_Title: "Ticket Closed"
|
||||||
TicketBlackListMessage: "You are not allowed to open a ticket"
|
TicketBlackListMessage: "You are not allowed to open a ticket"
|
||||||
|
|
||||||
|
MaxAllowedTickets: 2
|
||||||
|
|
||||||
TicketSubject: "description"
|
TicketSubject: "description"
|
||||||
# "description" will displays the ticket reason within the channel description
|
# "description" will display the ticket reason within the channel description
|
||||||
# "embed" will displays the ticket reason within the ticket embed
|
# "embed" will display the ticket reason within the ticket embed
|
||||||
|
|
||||||
AllowTicketMentions: true
|
AllowTicketMentions: true
|
||||||
# Set to true to allow the ticket to mention the author and the support team.
|
# Set to true to allow the ticket to mention the author and the support team.
|
||||||
# Set to false to dis-allow mentions within tickets.
|
# 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 ---
|
# --- Creation Config ---
|
||||||
# --- Start ---
|
# --- Start ---
|
||||||
@@ -119,13 +180,11 @@ RemovedUser: "👍 <@%user%> has been removed from this ticket"
|
|||||||
# --- Start ---
|
# --- Start ---
|
||||||
|
|
||||||
# Discord Button Colour Selection
|
# Discord Button Colour Selection
|
||||||
# PRIMARY - Blurple
|
# PRIMARY - Blue
|
||||||
|
# SECONDARY - Grey
|
||||||
# DANGER - Red
|
# DANGER - Red
|
||||||
# SUCCESS - Green
|
# SUCCESS - Green
|
||||||
# Secondary - Grey
|
|
||||||
|
|
||||||
TicketLockReaction: "🔒"
|
|
||||||
TicketDeleteReaction: "⛔"
|
|
||||||
LockTicketCategory: "Archive"
|
LockTicketCategory: "Archive"
|
||||||
|
|
||||||
TicketCloseEmoji: "❌"
|
TicketCloseEmoji: "❌"
|
||||||
@@ -136,46 +195,58 @@ TicketCloseColour: "DANGER"
|
|||||||
TicketDeleteColour: "DANGER"
|
TicketDeleteColour: "DANGER"
|
||||||
TicketLockColour: "PRIMARY"
|
TicketLockColour: "PRIMARY"
|
||||||
|
|
||||||
TicketDept1Colour: "PRIMARY"
|
|
||||||
TicketDept2Colour: "PRIMARY"
|
|
||||||
TicketDept3Colour: "PRIMARY"
|
|
||||||
|
|
||||||
TicketDept1Emoji: "1️⃣"
|
|
||||||
TicketDept2Emoji: "2️⃣"
|
|
||||||
TicketDept3Emoji: "3️⃣"
|
|
||||||
|
|
||||||
TranscriptSavedMessage: "📝 **Transcript Saved!**"
|
TranscriptSavedMessage: "📝 **Transcript Saved!**"
|
||||||
TicketLockMessage: "❌ **Ticket Locked!**"
|
TicketLockMessage: "❌ **Ticket Locked!**"
|
||||||
TicketDeleteMessage: "⚠ **Ticket Deleting!**" # Tickets deleting after 5 seconds by default.
|
TicketDeleteMessage: "⚠ **Ticket Deleting!**" # Tickets deleting after 5 seconds by default.
|
||||||
TicketDeleteTime: 5000 # Time must be set in milliseconds.
|
|
||||||
|
|
||||||
# --- Departments Config ---
|
# --- Departments Config ---
|
||||||
# --- Start ---
|
# --- Start ---
|
||||||
|
|
||||||
TicketDepartments: true
|
TicketDepartments: true
|
||||||
|
# Delete the ticket if no department selected. TIME IN MINUTES
|
||||||
|
Timeout: 5
|
||||||
|
# Set to true to allow all staff to access the ticket
|
||||||
|
AllowAllStaff: false
|
||||||
|
|
||||||
AllowStaff: true
|
|
||||||
# If set to false 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.
|
|
||||||
|
|
||||||
DepartmentTitle_1: "General Support"
|
|
||||||
DepartmentTitle_2: "Billing Support"
|
|
||||||
DepartmentTitle_3: "Admin Team"
|
|
||||||
# Ticket department title, This is the title for a ticket department to help users know what is available.
|
|
||||||
|
|
||||||
DepartmentRole_1: "Support Team"
|
|
||||||
DepartmentRole_2: "Support Team"
|
|
||||||
DepartmentRole_3: "Project Developer"
|
|
||||||
# Ticket roles are the roles that will be able to gain access to tickets depending on what department has been chosen.
|
# 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: "Billing Support"
|
||||||
|
|
||||||
|
- title: "Billing Support"
|
||||||
|
role: "Staff"
|
||||||
|
color: "SECONDARY"
|
||||||
|
emoji: "2️⃣"
|
||||||
|
category: "Admin Team"
|
||||||
|
|
||||||
|
- title: "Admin Team"
|
||||||
|
role: "Admin"
|
||||||
|
color: "SECONDARY"
|
||||||
|
emoji: "3️⃣"
|
||||||
|
category: "Admin Support"
|
||||||
|
# - title: "Other"
|
||||||
|
# role: "Staff"
|
||||||
|
# color: "SECONDARY"
|
||||||
|
# emoji: "3️⃣"
|
||||||
|
# category: "Tickets"
|
||||||
|
|
||||||
|
# Discord Button Colour Selection
|
||||||
|
# PRIMARY - Blurple
|
||||||
|
# SECONDARY - Grey
|
||||||
|
# DANGER - Red
|
||||||
|
# SUCCESS - Green
|
||||||
|
|
||||||
# --- Closing Config ---
|
# --- Closing Config ---
|
||||||
# --- Start ---
|
# --- Start ---
|
||||||
|
|
||||||
|
StaffOnly: true
|
||||||
ClosingTicket: ":warning: You have requested to close your support ticket."
|
ClosingTicket: ":warning: You have requested to close your support ticket."
|
||||||
ClosingConfirmation_Word: "confirm"
|
ClosingConfirmation_Word: "confirm"
|
||||||
CloseConfirmation: false
|
CloseConfirmation: true
|
||||||
|
|
||||||
# ---------------------------
|
# ---------------------------
|
||||||
# Error / Warning Messages
|
# Error / Warning Messages
|
||||||
@@ -7,8 +7,8 @@
|
|||||||
# SupportBot created by Emerald Services
|
# SupportBot created by Emerald Services
|
||||||
# Installed with MIT License
|
# Installed with MIT License
|
||||||
#
|
#
|
||||||
# Discord Support: https:#emeraldsrv.dev/discord
|
# Discord Support: https://emeraldsrv.dev/discord
|
||||||
# Community Resources: https:#emeraldsrv.dev/resources
|
# Community Resources: https://emeraldsrv.dev/resources
|
||||||
|
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
# Ticket Panel Configuration
|
# Ticket Panel Configuration
|
||||||
@@ -20,12 +20,12 @@ TicketPanel: true
|
|||||||
# Ticket Panel Message Configuration
|
# Ticket Panel Message Configuration
|
||||||
# ----------------------------------------
|
# ----------------------------------------
|
||||||
|
|
||||||
Channel: "create-ticket"
|
Channel: "▣┃ticket-creation"
|
||||||
ButtonEmoji: "📩"
|
ButtonEmoji: "📩"
|
||||||
ButtonLabel: "Open Ticket"
|
ButtonLabel: "Create Ticket"
|
||||||
ButtonColour: "SUCCESS"
|
ButtonColour: "SUCCESS"
|
||||||
# Colour Options:
|
# Colour Options:
|
||||||
# -> PRIMARY - Blurple
|
# -> PRIMARY - Purple
|
||||||
# -> SECONDARY - Grey
|
# -> SECONDARY - Grey
|
||||||
# -> SUCCESS - Green
|
# -> SUCCESS - Green
|
||||||
# -> DANGER - Red
|
# -> DANGER - Red
|
||||||
@@ -33,8 +33,8 @@ ButtonColour: "SUCCESS"
|
|||||||
PanelTitle: "Need Help? Create a Support Ticket."
|
PanelTitle: "Need Help? Create a Support Ticket."
|
||||||
|
|
||||||
TicketPanel_Description: true
|
TicketPanel_Description: true
|
||||||
TicketPanel_Thumbnail: false
|
TicketPanel_Thumbnail: true
|
||||||
TicketPanel_Image: false
|
TicketPanel_Image: true
|
||||||
|
|
||||||
PanelMessage: "Click the button to open a new support ticket."
|
PanelMessage: "Click the button to open a new support ticket."
|
||||||
PanelThumbnail: "https://i.imgur.com/ieeZejl.png"
|
PanelThumbnail: "https://i.imgur.com/ieeZejl.png"
|
||||||
Vendored
BIN
Binary file not shown.
@@ -1 +1,3 @@
|
|||||||
{}
|
{
|
||||||
|
"tickets": []
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"id":0,"TicketPanelID":""}
|
||||||
@@ -1 +0,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!`)
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
+37
-86
@@ -5,19 +5,20 @@ const fs = require("fs");
|
|||||||
|
|
||||||
const Discord = require("discord.js");
|
const Discord = require("discord.js");
|
||||||
const yaml = require("js-yaml");
|
const yaml = require("js-yaml");
|
||||||
const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
|
const supportbot = yaml.load(
|
||||||
const cmdconfig = yaml.load(fs.readFileSync("./Data/commands.yml", "utf8"));
|
fs.readFileSync("./Configs/supportbot.yml", "utf8")
|
||||||
|
);
|
||||||
|
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
|
||||||
|
|
||||||
const Event = require("../Structures/Event.js");
|
const Event = require("../Structures/Event.js");
|
||||||
|
|
||||||
module.exports = new Event("interactionCreate", (client, interaction) => {
|
module.exports = new Event("interactionCreate", async (client, interaction) => {
|
||||||
if (interaction.isCommand()) {
|
if (interaction.isCommand()) {
|
||||||
const command = client.commands.find(
|
const command = client.commands.find(
|
||||||
(cmd) => cmd.name.toLowerCase() == interaction.commandName
|
(cmd) => cmd.name.toLowerCase() === interaction.commandName
|
||||||
);
|
);
|
||||||
|
|
||||||
if (interaction.user.bot || !interaction.isCommand() || !interaction.guild)
|
if (interaction.user.bot || !interaction.guild) return;
|
||||||
return;
|
|
||||||
|
|
||||||
const NotValid = new Discord.MessageEmbed()
|
const NotValid = new Discord.MessageEmbed()
|
||||||
.setDescription(`:x: \`Invalid Command\` `)
|
.setDescription(`:x: \`Invalid Command\` `)
|
||||||
@@ -28,7 +29,7 @@ module.exports = new Event("interactionCreate", (client, interaction) => {
|
|||||||
embeds: [NotValid],
|
embeds: [NotValid],
|
||||||
});
|
});
|
||||||
|
|
||||||
const permission = interaction.member.permissions.has(command.permission);
|
const permission = interaction.member.permissions.has(command.permissions);
|
||||||
|
|
||||||
const ValidPerms = new Discord.MessageEmbed()
|
const ValidPerms = new Discord.MessageEmbed()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
@@ -40,11 +41,13 @@ module.exports = new Event("interactionCreate", (client, interaction) => {
|
|||||||
return interaction.reply({
|
return interaction.reply({
|
||||||
embeds: [ValidPerms],
|
embeds: [ValidPerms],
|
||||||
});
|
});
|
||||||
interaction.user = interaction.user;
|
|
||||||
command.run(interaction);
|
command.run(interaction);
|
||||||
}
|
}
|
||||||
if (interaction.isButton()) {
|
if (interaction.isButton()) {
|
||||||
if (interaction.customId === "openticket") {
|
if (
|
||||||
|
interaction.customId === "openticket" ||
|
||||||
|
interaction.customId.includes("department-")
|
||||||
|
) {
|
||||||
try {
|
try {
|
||||||
const cmd = client.commands.get(cmdconfig.OpenTicket);
|
const cmd = client.commands.get(cmdconfig.OpenTicket);
|
||||||
if (!cmd) return;
|
if (!cmd) return;
|
||||||
@@ -55,78 +58,17 @@ module.exports = new Event("interactionCreate", (client, interaction) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (interaction.customId === "ticketclose") {
|
if (interaction.customId === "ticketclose") {
|
||||||
if (interaction.channel.name.startsWith(`${supportbot.TicketChannel}-`)) {
|
try {
|
||||||
interaction.message.fetch();
|
const cmd = client.commands.get(cmdconfig.CloseTicket);
|
||||||
interaction.deferUpdate();
|
if (!cmd) return;
|
||||||
const DeleteTicketEmbed = new Discord.MessageEmbed()
|
cmd.run(interaction);
|
||||||
.setDescription(supportbot.TicketDeleteMessage)
|
} catch (error) {
|
||||||
.setColor(supportbot.EmbedColour);
|
console.error(error);
|
||||||
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 Discord.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 Discord.MessageEmbed()
|
|
||||||
.setDescription(supportbot.TranscriptSavedMessage)
|
|
||||||
.setColor(supportbot.SuccessColour);
|
|
||||||
interaction.channel.send({ embeds: [TranscriptSavedEmbed] });
|
|
||||||
|
|
||||||
let file = new Discord.MessageAttachment(
|
|
||||||
Buffer.from(html),
|
|
||||||
`${name}.html`
|
|
||||||
);
|
|
||||||
logChannel.send({ embeds: [logEmbed], files: [file] });
|
|
||||||
|
|
||||||
setTimeout(
|
|
||||||
() => interaction.channel.delete(),
|
|
||||||
supportbot.TicketDeleteTime
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (interaction.customId === "ticketlock") {
|
if (interaction.customId === "ticketlock") {
|
||||||
if (interaction.channel.name.startsWith(`${supportbot.TicketChannel}`)) {
|
if (interaction.channel.name.startsWith(supportbot.TicketPrefix)) {
|
||||||
interaction.message.fetch();
|
interaction.message.fetch();
|
||||||
interaction.deferUpdate();
|
|
||||||
let Admin =
|
let Admin =
|
||||||
interaction.guild.roles.cache.find(
|
interaction.guild.roles.cache.find(
|
||||||
(AdminUser) => AdminUser.name === supportbot.Admin
|
(AdminUser) => AdminUser.name === supportbot.Admin
|
||||||
@@ -134,29 +76,38 @@ module.exports = new Event("interactionCreate", (client, interaction) => {
|
|||||||
interaction.guild.roles.cache.find(
|
interaction.guild.roles.cache.find(
|
||||||
(AdminUser) => AdminUser.id === supportbot.Admin
|
(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 all = interaction.channel.permissionOverwrites.cache;
|
||||||
|
|
||||||
let parent =
|
let parent =
|
||||||
interaction.guild.channels.cache.find(
|
interaction.guild.channels.cache.find(
|
||||||
(c) => c.name === `${supportbot.LockTicketCategory}`
|
(c) => c.name === supportbot.LockTicketCategory
|
||||||
) ||
|
) ||
|
||||||
interaction.guild.channels.cache.find(
|
interaction.guild.channels.cache.find(
|
||||||
(c) => c.id === `${supportbot.LockTicketCategory}`
|
(c) => c.id === supportbot.LockTicketCategory
|
||||||
);
|
);
|
||||||
if (parent) {
|
if (parent) {
|
||||||
interaction.channel.setParent(parent.id);
|
await interaction.channel.setParent(parent.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
all.forEach((perm) => {
|
all.forEach((perm) => {
|
||||||
interaction.channel.permissionOverwrites.delete(perm.id);
|
interaction.channel.permissionOverwrites.delete(perm.id);
|
||||||
});
|
});
|
||||||
interaction.channel.permissionOverwrites.create(Admin.id, {
|
await interaction.channel.permissionOverwrites.create(Admin.id, {
|
||||||
VIEW_CHANNEL: true,
|
VIEW_CHANNEL: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
interaction.channel.permissionOverwrites.create(interaction.guild.id, {
|
await interaction.channel.permissionOverwrites.create(
|
||||||
VIEW_CHANNEL: false,
|
interaction.guild.id,
|
||||||
});
|
{
|
||||||
|
VIEW_CHANNEL: false,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
const ticketDeleteButton = new Discord.MessageButton()
|
const ticketDeleteButton = new Discord.MessageButton()
|
||||||
.setCustomId("ticketclose")
|
.setCustomId("ticketclose")
|
||||||
@@ -170,9 +121,9 @@ module.exports = new Event("interactionCreate", (client, interaction) => {
|
|||||||
const ArchiveEmbed = new Discord.MessageEmbed()
|
const ArchiveEmbed = new Discord.MessageEmbed()
|
||||||
.setTitle("Archived")
|
.setTitle("Archived")
|
||||||
.setDescription(`Archived ${interaction.channel.name}`)
|
.setDescription(`Archived ${interaction.channel.name}`)
|
||||||
.setColor(`${supportbot.SuccessColour}`);
|
.setColor(supportbot.SuccessColour);
|
||||||
|
|
||||||
interaction.channel.send({ embeds: [ArchiveEmbed] });
|
interaction.reply({ embeds: [ArchiveEmbed] });
|
||||||
interaction.message.edit({ components: [row] });
|
interaction.message.edit({ components: [row] });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
// 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("./Data/supportbot.yml", "utf8"));
|
|
||||||
const cmdconfig = yaml.load(fs.readFileSync("./Data/commands.yml", "utf8"));
|
|
||||||
const panelconfig = yaml.load(
|
|
||||||
fs.readFileSync("./Data/ticket-panel.yml", "utf8")
|
|
||||||
);
|
|
||||||
|
|
||||||
const Event = require("../Structures/Event.js");
|
|
||||||
|
|
||||||
module.exports = new Event("messageReactionAdd", async (client) => {
|
|
||||||
let message = {
|
|
||||||
guild: reaction.message.channel.guild,
|
|
||||||
author: user,
|
|
||||||
content: "N/A",
|
|
||||||
channel: reaction.message.channel,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (panelconfig.TicketPanel) {
|
|
||||||
if (reaction.message.id === panelconfig.TicketPanelID) {
|
|
||||||
if (
|
|
||||||
reaction.emoji.name == panelconfig.ButtonEmoji ||
|
|
||||||
reaction.emoji.id == panelconfig.ButtonEmoji
|
|
||||||
) {
|
|
||||||
await reaction.users.remove(user.id);
|
|
||||||
|
|
||||||
try {
|
|
||||||
const cmd = client.commands.get(cmdconfig.OpenTicket);
|
|
||||||
if (!cmd) return;
|
|
||||||
|
|
||||||
cmd.run(message, message.content);
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
+118
-22
@@ -5,14 +5,17 @@ const fs = require("fs");
|
|||||||
|
|
||||||
const Discord = require("discord.js");
|
const Discord = require("discord.js");
|
||||||
const yaml = require("js-yaml");
|
const yaml = require("js-yaml");
|
||||||
const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
|
const supportbot = yaml.load(
|
||||||
|
fs.readFileSync("./Configs/supportbot.yml", "utf8")
|
||||||
|
);
|
||||||
const panelconfig = yaml.load(
|
const panelconfig = yaml.load(
|
||||||
fs.readFileSync("./Data/ticket-panel.yml", "utf8")
|
fs.readFileSync("./Configs/ticket-panel.yml", "utf8")
|
||||||
);
|
);
|
||||||
|
|
||||||
const Event = require("../Structures/Event.js");
|
const Event = require("../Structures/Event.js");
|
||||||
|
|
||||||
module.exports = new Event("ready", (client) => {
|
module.exports = new Event("ready", async (client, interaction) => {
|
||||||
|
const { getRole, getChannel, getCategory } = client;
|
||||||
client.user.setActivity(supportbot.BotActivity, {
|
client.user.setActivity(supportbot.BotActivity, {
|
||||||
type: supportbot.ActivityType,
|
type: supportbot.ActivityType,
|
||||||
url: supportbot.StreamingURL,
|
url: supportbot.StreamingURL,
|
||||||
@@ -31,10 +34,18 @@ module.exports = new Event("ready", (client) => {
|
|||||||
console.log(` `);
|
console.log(` `);
|
||||||
console.log(
|
console.log(
|
||||||
`\u001b[33m`,
|
`\u001b[33m`,
|
||||||
`${supportbot.Name} v${supportbot.SupportBot_Version}`,
|
`${supportbot.Name} | v${supportbot.SupportBot_Version}`,
|
||||||
`\u001b[36m`,
|
`\u001b[36m`,
|
||||||
`Connected to Discord`
|
`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(
|
console.log(
|
||||||
`\u001b[33m`,
|
`\u001b[33m`,
|
||||||
`Resources:`,
|
`Resources:`,
|
||||||
@@ -45,7 +56,7 @@ module.exports = new Event("ready", (client) => {
|
|||||||
`\u001b[33m`,
|
`\u001b[33m`,
|
||||||
`Documentation:`,
|
`Documentation:`,
|
||||||
`\u001b[36m`,
|
`\u001b[36m`,
|
||||||
`https://supportbot.emeraldsrv.dev`
|
`https://emeraldsrv.dev/wiki/supportbot`
|
||||||
);
|
);
|
||||||
console.log(
|
console.log(
|
||||||
`\u001b[33m`,
|
`\u001b[33m`,
|
||||||
@@ -64,9 +75,77 @@ module.exports = new Event("ready", (client) => {
|
|||||||
console.log(` `);
|
console.log(` `);
|
||||||
console.log(`\u001b[31m`, `――――――――――――――――――――――――――――――――――――――――――――`);
|
console.log(`\u001b[31m`, `――――――――――――――――――――――――――――――――――――――――――――`);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const roles = [
|
||||||
|
supportbot.Admin,
|
||||||
|
supportbot.Staff,
|
||||||
|
supportbot.TicketBlackListRole,
|
||||||
|
];
|
||||||
|
if (supportbot.TicketDepartments) {
|
||||||
|
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) {
|
if (panelconfig.TicketPanel) {
|
||||||
let chan1 = client.channels.cache.find(
|
let chan1 = await client.getChannel(
|
||||||
(channel) => channel.name === panelconfig.Channel
|
panelconfig.Channel,
|
||||||
|
client.guilds.cache.first()
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!chan1) {
|
if (!chan1) {
|
||||||
@@ -77,15 +156,18 @@ module.exports = new Event("ready", (client) => {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const panelid = yaml.load(
|
const panelid = JSON.parse(
|
||||||
fs.readFileSync("./Data/ticket-panel-id.yml", "utf8")
|
fs.readFileSync("./Data/ticket-panel-id.json", "utf8")
|
||||||
);
|
);
|
||||||
|
|
||||||
chan1.messages.fetch(panelid.TicketPanelID).catch(async (r) => {
|
chan1.messages.fetch(panelid.TicketPanelID).catch(async () => {
|
||||||
let embed = new Discord.MessageEmbed()
|
let embed = new Discord.MessageEmbed()
|
||||||
.setTitle(`${panelconfig.PanelTitle}`)
|
.setTitle(panelconfig.PanelTitle)
|
||||||
.setColor(supportbot.SuccessColour)
|
.setColor(supportbot.SuccessColour)
|
||||||
.setFooter(supportbot.EmbedFooter);
|
.setFooter({
|
||||||
|
text: supportbot.EmbedFooter,
|
||||||
|
iconURL: interaction.user.displayAvatarURL(),
|
||||||
|
});
|
||||||
|
|
||||||
if (panelconfig.TicketPanel_Description) {
|
if (panelconfig.TicketPanel_Description) {
|
||||||
embed.setDescription(panelconfig.PanelMessage);
|
embed.setDescription(panelconfig.PanelMessage);
|
||||||
@@ -98,12 +180,22 @@ module.exports = new Event("ready", (client) => {
|
|||||||
if (panelconfig.TicketPanel_Image) {
|
if (panelconfig.TicketPanel_Image) {
|
||||||
embed.setImage(panelconfig.PanelImage);
|
embed.setImage(panelconfig.PanelImage);
|
||||||
}
|
}
|
||||||
|
let button;
|
||||||
let button = new Discord.MessageButton()
|
if (supportbot.TicketDepartments) {
|
||||||
.setLabel(panelconfig.ButtonLabel)
|
button = supportbot.Departments.map((x) =>
|
||||||
.setCustomId("openticket")
|
new Discord.MessageButton()
|
||||||
.setStyle(panelconfig.ButtonColour);
|
.setCustomId("department-" + supportbot.Departments.indexOf(x))
|
||||||
|
.setLabel(x.title)
|
||||||
|
.setStyle(x.color)
|
||||||
|
.setEmoji(x.emoji)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
button = new Discord.MessageButton()
|
||||||
|
.setLabel(panelconfig.ButtonLabel)
|
||||||
|
.setCustomId("openticket")
|
||||||
|
.setStyle(panelconfig.ButtonColour)
|
||||||
|
.setEmoji(panelconfig.ButtonEmoji);
|
||||||
|
}
|
||||||
let row = new Discord.MessageActionRow().addComponents(button);
|
let row = new Discord.MessageActionRow().addComponents(button);
|
||||||
|
|
||||||
await chan1
|
await chan1
|
||||||
@@ -113,13 +205,17 @@ module.exports = new Event("ready", (client) => {
|
|||||||
})
|
})
|
||||||
.then((r) => {
|
.then((r) => {
|
||||||
let data = {
|
let data = {
|
||||||
TicketPanelID: `${r.id}`,
|
id: panelid.id,
|
||||||
|
TicketPanelID: r.id,
|
||||||
};
|
};
|
||||||
let yamlStr = yaml.dump(data);
|
fs.writeFileSync(
|
||||||
fs.writeFileSync("./Data/ticket-panel-id.yml", yamlStr, "utf8");
|
"./Data/ticket-panel-id.json",
|
||||||
|
JSON.stringify(data),
|
||||||
|
"utf8"
|
||||||
|
);
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
console.log("Raw" + e);
|
console.log("Raw: " + e);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|

|
||||||
|
|
||||||
|
## What is SupportBot?
|
||||||
|
|
||||||
|
SupportBot is an open-sourced support system for discord. It's completely free to use with high amounts of customization to match your own brand.
|
||||||
|
|
||||||
|
## Quick Links
|
||||||
|
|
||||||
|
**|** [Discord](https://emeraldsrv.dev/discord) **|**
|
||||||
|
[Hosting](https://emeraldsrv.dev/hosting) **|**
|
||||||
|
[Documentation](https://emeraldsrv.dev/wiki/supportbot) **|**
|
||||||
|
[Download via MC-Market](https://www.mc-market.org/resources/8940/) **|**
|
||||||
@@ -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 };
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
// SupportBot | Emerald Services
|
|
||||||
// Addon Structure
|
|
||||||
|
|
||||||
const fs = require("fs");
|
|
||||||
|
|
||||||
const Discord = require("discord.js");
|
|
||||||
|
|
||||||
const yaml = require("js-yaml");
|
|
||||||
const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
|
|
||||||
|
|
||||||
function RunFunction(interaction) {}
|
|
||||||
|
|
||||||
class Addon {
|
|
||||||
constructor(options) {
|
|
||||||
this.name = options.name;
|
|
||||||
this.description = options.description;
|
|
||||||
this.permission = options.permission;
|
|
||||||
this.slashCommandOptions = options.slashCommandOptions || [];
|
|
||||||
this.run = options.run;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = Addon;
|
|
||||||
+68
-41
@@ -4,12 +4,12 @@
|
|||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
|
|
||||||
const Discord = require("discord.js");
|
const Discord = require("discord.js");
|
||||||
const Command = require("./Command.js");
|
|
||||||
const Event = require("./Event.js");
|
|
||||||
const intents = new Discord.Intents(32767);
|
const intents = new Discord.Intents(32767);
|
||||||
|
|
||||||
const yaml = require("js-yaml");
|
const yaml = require("js-yaml");
|
||||||
const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
|
const supportbot = yaml.load(
|
||||||
|
fs.readFileSync("./Configs/supportbot.yml", "utf8")
|
||||||
|
);
|
||||||
|
|
||||||
class Client extends Discord.Client {
|
class Client extends Discord.Client {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -17,14 +17,48 @@ class Client extends Discord.Client {
|
|||||||
|
|
||||||
this.commands = new Discord.Collection();
|
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())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
start(token) {
|
async start(token) {
|
||||||
const commandFiles = fs
|
var tempCommandFiles = fs.readdirSync("./Commands").filter((file) => file.endsWith(".js"));
|
||||||
.readdirSync("./Commands")
|
|
||||||
|
if (supportbot.DisableSuggestions) {
|
||||||
|
tempCommandFiles = tempCommandFiles.filter(item => item !== "suggest.js");
|
||||||
|
}
|
||||||
|
|
||||||
|
const commandFiles = tempCommandFiles;
|
||||||
|
|
||||||
|
const addonFiles = fs
|
||||||
|
.readdirSync("./Addons")
|
||||||
.filter((file) => file.endsWith(".js"));
|
.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}`));
|
const commands = commandFiles.map((file) => require(`../Commands/${file}`));
|
||||||
|
|
||||||
|
// Commands
|
||||||
console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Commands ▬▬▬▬▬▬▬");
|
console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Commands ▬▬▬▬▬▬▬");
|
||||||
|
|
||||||
commands.forEach((cmd) => {
|
commands.forEach((cmd) => {
|
||||||
@@ -33,47 +67,36 @@ class Client extends Discord.Client {
|
|||||||
});
|
});
|
||||||
|
|
||||||
console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Commands ▬▬▬▬▬▬▬");
|
console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Commands ▬▬▬▬▬▬▬");
|
||||||
|
|
||||||
// Addons
|
// Addons
|
||||||
|
|
||||||
const addonFiles = fs
|
|
||||||
.readdirSync("./Addons")
|
|
||||||
.filter((file) => file.endsWith(".js"));
|
|
||||||
|
|
||||||
const addons = addonFiles.map((file) => require(`../Addons/${file}`));
|
|
||||||
|
|
||||||
console.log(" ");
|
console.log(" ");
|
||||||
console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Addons ▬▬▬▬▬▬▬");
|
console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Addons ▬▬▬▬▬▬▬");
|
||||||
|
|
||||||
addons.forEach((addon) => {
|
addons.forEach((addon) => {
|
||||||
console.log(`\u001b[31;1m`, `${addon.name}`, `\u001b[32;1m`, "Loaded");
|
console.log(
|
||||||
this.commands.set(addon.name, addon);
|
`\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 ▬▬▬▬▬▬▬");
|
console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Addons ▬▬▬▬▬▬▬");
|
||||||
console.log(" ");
|
|
||||||
|
|
||||||
// Slash Commands
|
// Slash Commands
|
||||||
|
|
||||||
const slashCommands = commands.map((cmd) => ({
|
this.once("ready", async () => {
|
||||||
name: cmd.name.toLowerCase(),
|
await this.guilds.cache.first()?.commands.set(this.commands);
|
||||||
description: cmd.description,
|
console.log(
|
||||||
permissions: [],
|
`\u001b[32;1m`,
|
||||||
options: cmd.slashCommandOptions,
|
`Slash Commands Registered for ${this.guilds.cache.first().name}`
|
||||||
defaultPermission: true,
|
|
||||||
}));
|
|
||||||
|
|
||||||
this.removeAllListeners();
|
|
||||||
|
|
||||||
this.on("ready", async () => {
|
|
||||||
const cmds = await this.application?.commands.set(slashCommands);
|
|
||||||
|
|
||||||
console.log(" ");
|
|
||||||
console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Slash Command ▬▬▬▬▬▬▬"),
|
|
||||||
console.log(" ");
|
|
||||||
|
|
||||||
cmds.forEach((cmd) =>
|
|
||||||
console.log(`Slash Command ${cmd.name} registered`)
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -85,14 +108,18 @@ class Client extends Discord.Client {
|
|||||||
.forEach((file) => {
|
.forEach((file) => {
|
||||||
const event = require(`../Events/${file}`);
|
const event = require(`../Events/${file}`);
|
||||||
console.log(`\u001b[31;1m`, `${event.event}`, `\u001b[32;1m`, "Loaded");
|
console.log(`\u001b[31;1m`, `${event.event}`, `\u001b[32;1m`, "Loaded");
|
||||||
|
this.on(event.event, (...args) => event.run(this, ...args));
|
||||||
this.on(event.event, event.run.bind(null, this));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Events ▬▬▬▬▬▬▬");
|
console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Events ▬▬▬▬▬▬▬");
|
||||||
console.log(" ");
|
if (process.argv[2] !== "test") {
|
||||||
|
await this.login(token);
|
||||||
this.login(token);
|
} else {
|
||||||
|
console.log(
|
||||||
|
`\u001b[31;1m`,
|
||||||
|
"RUNNING IN TEST MODE, IF NOT INTENDED, PLEASE USE npm start"
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-12
@@ -1,23 +1,14 @@
|
|||||||
// SupportBot | Emerald Services
|
// SupportBot | Emerald Services
|
||||||
// Command Structure
|
// Command Structure
|
||||||
|
|
||||||
const fs = require("fs");
|
|
||||||
|
|
||||||
const Discord = require("discord.js");
|
|
||||||
|
|
||||||
const yaml = require("js-yaml");
|
|
||||||
const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
|
|
||||||
|
|
||||||
function RunFunction(interaction) {}
|
|
||||||
|
|
||||||
class Command {
|
class Command {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
this.name = options.name;
|
this.name = options.name;
|
||||||
this.description = options.description;
|
this.description = options.description;
|
||||||
this.permission = options.permission;
|
this.permissions = options.permissions || [];
|
||||||
this.slashCommandOptions = options.slashCommandOptions || [];
|
this.options = options.options || [];
|
||||||
this.run = options.run;
|
this.run = options.run;
|
||||||
|
this.defaultPermission = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Command;
|
module.exports = Command;
|
||||||
+2
-12
@@ -1,19 +1,9 @@
|
|||||||
// SupportBot | Emerald Services
|
// SupportBot | Emerald Services
|
||||||
// Event Structure
|
// Event Structure
|
||||||
|
|
||||||
const fs = require("fs");
|
|
||||||
|
|
||||||
const Discord = require("discord.js");
|
|
||||||
|
|
||||||
const yaml = require("js-yaml");
|
|
||||||
const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
|
|
||||||
|
|
||||||
function RunFunction(client, ...eventArgs) {}
|
|
||||||
|
|
||||||
class Event {
|
class Event {
|
||||||
constructor(event, runFunction) {
|
constructor(event, run) {
|
||||||
this.event = event;
|
this.event = event;
|
||||||
this.run = runFunction;
|
this.run = run;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+19
-62
@@ -3,87 +3,44 @@
|
|||||||
|
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
|
|
||||||
const Discord = require("discord.js");
|
|
||||||
const Command = require("./Command.js");
|
|
||||||
const Client = require("./Client.js");
|
|
||||||
const Event = require("./Event.js");
|
|
||||||
|
|
||||||
const yaml = require("js-yaml");
|
|
||||||
const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
|
|
||||||
|
|
||||||
class TicketNumberID {
|
class TicketNumberID {
|
||||||
static pad(guildId) {
|
static async pad() {
|
||||||
let n = this.get(guildId) + "";
|
let num = await this.get();
|
||||||
let z = "0";
|
let n = num + "";
|
||||||
let width = 4;
|
await this.set(num + 1);
|
||||||
setTimeout(() => {
|
return n.length >= 4 ? n : new Array(4 - n.length + 1).join("0") + n;
|
||||||
this.set(guildId, this.get(guildId) + 1);
|
|
||||||
}, 50);
|
|
||||||
return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static get(guildId) {
|
static async get() {
|
||||||
let ticketnumberID = JSON.parse(
|
let ticketnumberID = await JSON.parse(
|
||||||
fs.readFileSync("./Data/TicketData.json", "utf8")
|
fs.readFileSync("./Data/ticket-panel-id.json", "utf8")
|
||||||
);
|
);
|
||||||
|
if (!ticketnumberID.id) {
|
||||||
if (!ticketnumberID[guildId]) {
|
return this.set(0);
|
||||||
ticketnumberID[guildId] = {
|
|
||||||
id: 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
fs.writeFileSync(
|
|
||||||
"./Data/TicketData.json",
|
|
||||||
JSON.stringify(ticketnumberID, null, 4),
|
|
||||||
(err) => {
|
|
||||||
if (err) console.log(err);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
} else {
|
} else {
|
||||||
return ticketnumberID[guildId].id;
|
return ticketnumberID.id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static set(guildId, value) {
|
static async set(value) {
|
||||||
let ticketnumberID = JSON.parse(
|
let ticketnumberID = await JSON.parse(
|
||||||
fs.readFileSync("./Data/TicketData.json", "utf8")
|
fs.readFileSync("./Data/ticket-panel-id.json", "utf8")
|
||||||
);
|
);
|
||||||
|
|
||||||
ticketnumberID[guildId] = {
|
ticketnumberID.id = value;
|
||||||
id: value,
|
|
||||||
};
|
|
||||||
|
|
||||||
fs.writeFileSync(
|
fs.writeFileSync(
|
||||||
"./Data/TicketData.json",
|
"./Data/ticket-panel-id.json",
|
||||||
JSON.stringify(ticketnumberID, null, 4),
|
JSON.stringify(ticketnumberID, null, 4),
|
||||||
(err) => {
|
(err) => {
|
||||||
if (err) console.log(err);
|
if (err) console.error(err);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static reset(guildId) {
|
static async reset() {
|
||||||
let ticketnumberID = JSON.parse(
|
return await this.set(0);
|
||||||
fs.readFileSync("./Data/TicketData.json", "utf8")
|
|
||||||
);
|
|
||||||
|
|
||||||
ticketnumberID[guildId] = {
|
|
||||||
id: 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
fs.writeFileSync(
|
|
||||||
"./Data/TicketData.json",
|
|
||||||
JSON.stringify(ticketnumberID, null, 4),
|
|
||||||
(err) => {
|
|
||||||
if (err) console.log(err);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,9 +12,10 @@
|
|||||||
|
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
|
|
||||||
const Discord = require("discord.js");
|
|
||||||
const yaml = require("js-yaml");
|
const yaml = require("js-yaml");
|
||||||
const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
|
const supportbot = yaml.load(
|
||||||
|
fs.readFileSync("./Configs/supportbot.yml", "utf8")
|
||||||
|
);
|
||||||
|
|
||||||
const Client = require("./Structures/Client.js");
|
const Client = require("./Structures/Client.js");
|
||||||
const client = new Client({});
|
const client = new Client({});
|
||||||
|
|||||||
Generated
+5034
-214
File diff suppressed because it is too large.
Load diff
+12
-7
@@ -1,23 +1,28 @@
|
|||||||
{
|
{
|
||||||
"name": "supportbot",
|
"name": "supportbot",
|
||||||
"version": "7.2.0",
|
"version": "7.4.2",
|
||||||
"description": "SupportBot is an open-sourced support system for discord. It's completely free to use with high amounts of customization to match your own brand.",
|
"description": "SupportBot is an open-sourced support system for discord. It's completely free to use with high amounts of customization to match your own brand.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "npm i && node index.js"
|
"start": "npm i && node index.js",
|
||||||
|
"test": "node index.js test"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/1tzemerald/SupportBot.git"
|
"url": "git+https://github.com/Emerald-Services/SupportBot.git"
|
||||||
},
|
},
|
||||||
"author": "Emerald Services",
|
"author": "Emerald Services",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/1tzemerald/SupportBot/issues"
|
"url": "https://github.com/Emerald-Services/SupportBot/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/1tzemerald/SupportBot#readme",
|
"homepage": "https://github.com/Emerald-Services/SupportBot#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"discord.js": "^13.2.0",
|
"@vitalets/google-translate-api": "^8.0.0",
|
||||||
"js-yaml": "^4.1.0"
|
"discord.js": "^13.6.0",
|
||||||
|
"js-yaml": "^4.1.0",
|
||||||
|
"moment": "^2.29.3",
|
||||||
|
"translate": "^1.4.1",
|
||||||
|
"twitter": "^1.7.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user