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

|
||||
|
||||
## What is SupportBot?
|
||||
|
||||
SupportBot is an open-sourced support system for discord. It's completely free to use with high amounts of customisation to match your own brand.
|
||||
|
||||
## Quick Links
|
||||
|
||||
**|** [Discord](https://emeraldsrv.dev/discord) **|**
|
||||
[Hosting](https://emeraldsrv.dev/hosting) **|**
|
||||
[Documentation](https://docs.emeraldsrv.dev) **|**
|
||||
[Download via Polymart](https://polymart.org/resource/supportbot-1-discord-ticket-bot.518) **|**
|
||||
[Download via MC-Market](https://www.mc-market.org/resources/8940/) **|**
|
||||
<h1 align="center">
|
||||
<br>
|
||||
<a href="https://github.com/Emerald-Services/SupportBot"><img src="https://i.imgur.com/tzi3d7Q.png"></a>
|
||||
<br>
|
||||
SupportBot
|
||||
<br>
|
||||
</h1>
|
||||
|
||||
<div align="center">
|
||||
|
||||
<a href="https://opensource.org/licenses/MIT">
|
||||
<img src="https://img.shields.io/badge/license-MIT-green?style=for-the-badge" alt="shield.png">
|
||||
</a>
|
||||
|
||||
<a href="https://github.com/discordjs">
|
||||
<img src="https://img.shields.io/badge/discord.js-v13.6.x-blue.svg?style=for-the-badge&logo=javascript.svg" alt="shield.png">
|
||||
</a>
|
||||
|
||||
<a href="https://github.com/nodejs/node">
|
||||
<img src="https://img.shields.io/badge/node.js-v16.14.x-green.svg?style=for-the-badge&logo=node" alt="shield.png">
|
||||
</a>
|
||||
|
||||
<a href="https://github.com/Emerald-Services/SupportBot/releases">
|
||||
<img src="https://img.shields.io/github/downloads/Emerald-Services/SupportBot/total?style=for-the-badge" alt="shield.png">
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://emeraldsrv.dev/">Website</a>
|
||||
•
|
||||
<a href="https://github.com/Emerald-Services/SupportBot/wiki">Wiki</a>
|
||||
<br>
|
||||
<a href="#about">About</a>
|
||||
•
|
||||
<a href="#support">Support</a>
|
||||
•
|
||||
<a href="#license">License</a>
|
||||
•
|
||||
<a href="https://github.com/Emerald-Services/SupportBot/wiki/Third-Party-Developer">Third-Party</a>
|
||||
•
|
||||
<a href="#contributors">Contributors</a>
|
||||
</p>
|
||||
|
||||
## About
|
||||
|
||||
SupportBot is an Open-Source discord bot built with [discord.js](https://github.com/discordjs/discord.js). It's primarily focused to help servers organise and manage their support system in a unique way with full customisation to match your brand.
|
||||
|
||||
## Support
|
||||
|
||||
<a href="https://emeraldsrv.dev/discord">
|
||||
<img alt="Discord" src="https://img.shields.io/discord/597779408295821323?logo=discord&logoColor=white&style=for-the-badge">
|
||||
</a>
|
||||
|
||||
|
||||
## License
|
||||
|
||||
Released under the [MIT](https://opensource.org/licenses/MIT) license.
|
||||
|
||||
|
||||
## Third-Party
|
||||
|
||||
- [Syphers Addons](https://github.com/SypherRed/SB_Addons_Unofficial)
|
||||
- [BuiltByBit](https://builtbybit.com/supportbot)
|
||||
- [Polymart](https://polymart.org/resource/supportbot-1-discord-ticket-bot.518)
|
||||
|
||||
|
||||
## Contributors
|
||||
|
||||
<a href="https://github.com/Emerald-Services/SupportBot/graphs/contributors">
|
||||
<img src="https://contrib.rocks/image?repo=Emerald-Services/SupportBot">
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
// SupportBot | Emerald Services
|
||||
// Addon Structure
|
||||
|
||||
class Command {
|
||||
constructor(options) {
|
||||
this.name = options.name;
|
||||
this.description = options.description;
|
||||
this.permissions = options.permissions;
|
||||
this.options = options.options || [];
|
||||
this.run = options.run;
|
||||
this.defaultPermission = true;
|
||||
}
|
||||
}
|
||||
class Event {
|
||||
constructor(event, run) {
|
||||
this.event = event;
|
||||
this.run = run;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { Command, Event };
|
||||
@@ -0,0 +1,126 @@
|
||||
// SupportBot | Emerald Services
|
||||
// Client Structure
|
||||
|
||||
const fs = require("fs");
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const intents = new Discord.Intents(32767);
|
||||
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(
|
||||
fs.readFileSync("./Configs/supportbot.yml", "utf8")
|
||||
);
|
||||
|
||||
class Client extends Discord.Client {
|
||||
constructor() {
|
||||
super({ intents });
|
||||
|
||||
this.commands = new Discord.Collection();
|
||||
}
|
||||
async getChannel(channel, guild) {
|
||||
return guild.channels.cache.find(
|
||||
(c) =>
|
||||
(c.type === "GUILD_TEXT" || c.type === "GUILD_NEWS") &&
|
||||
(c.id === channel || c.name.toLowerCase() === channel.toLowerCase())
|
||||
);
|
||||
}
|
||||
async getRole(role, guild) {
|
||||
return guild.roles.cache.find(
|
||||
(r) => r.id === role || r.name.toLowerCase() === role.toLowerCase()
|
||||
);
|
||||
}
|
||||
async getCategory(category, guild) {
|
||||
return guild.channels.cache.find(
|
||||
(c) =>
|
||||
c.type === "GUILD_CATEGORY" &&
|
||||
(c.id === category || c.name.toLowerCase() === category.toLowerCase())
|
||||
);
|
||||
}
|
||||
|
||||
async start(token) {
|
||||
var tempCommandFiles = fs.readdirSync("./Commands").filter((file) => file.endsWith(".js"));
|
||||
|
||||
if (supportbot.DisableSuggestions) {
|
||||
tempCommandFiles = tempCommandFiles.filter(item => item !== "suggest.js");
|
||||
}
|
||||
|
||||
const commandFiles = tempCommandFiles;
|
||||
|
||||
const addonFiles = fs
|
||||
.readdirSync("./Addons")
|
||||
.filter((file) => file.endsWith(".js"));
|
||||
|
||||
const addons = addonFiles.map((file) => {
|
||||
let addon = require(`../Addons/${file}`);
|
||||
addon.name = file.split(".")[0];
|
||||
return addon;
|
||||
});
|
||||
|
||||
const commands = commandFiles.map((file) => require(`../Commands/${file}`));
|
||||
|
||||
// Commands
|
||||
console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Commands ▬▬▬▬▬▬▬");
|
||||
|
||||
commands.forEach((cmd) => {
|
||||
console.log(`\u001b[31;1m`, `${cmd.name}`, `\u001b[32;1m`, "Loaded");
|
||||
this.commands.set(cmd.name, cmd);
|
||||
});
|
||||
|
||||
console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Commands ▬▬▬▬▬▬▬");
|
||||
// Addons
|
||||
console.log(" ");
|
||||
console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Addons ▬▬▬▬▬▬▬");
|
||||
|
||||
addons.forEach((addon) => {
|
||||
console.log(
|
||||
`\u001b[33m`,
|
||||
`[ADDON]`,
|
||||
`\u001b[31;1m`,
|
||||
`${addon.name}`,
|
||||
`\u001b[32;1m`,
|
||||
"Loaded"
|
||||
);
|
||||
addon.commands?.forEach((command) => {
|
||||
this.commands.set(command.name, command);
|
||||
});
|
||||
addon.events?.forEach((event) => {
|
||||
this.on(event.event, (...args) => event.run(this, ...args));
|
||||
});
|
||||
});
|
||||
|
||||
console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Addons ▬▬▬▬▬▬▬");
|
||||
|
||||
// Slash Commands
|
||||
|
||||
this.once("ready", async () => {
|
||||
await this.guilds.cache.first()?.commands.set(this.commands);
|
||||
console.log(
|
||||
`\u001b[32;1m`,
|
||||
`Slash Commands Registered for ${this.guilds.cache.first().name}`
|
||||
);
|
||||
});
|
||||
|
||||
console.log(" ");
|
||||
console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Events ▬▬▬▬▬▬▬");
|
||||
|
||||
fs.readdirSync("./Events")
|
||||
.filter((file) => file.endsWith(".js"))
|
||||
.forEach((file) => {
|
||||
const event = require(`../Events/${file}`);
|
||||
console.log(`\u001b[31;1m`, `${event.event}`, `\u001b[32;1m`, "Loaded");
|
||||
this.on(event.event, (...args) => event.run(this, ...args));
|
||||
});
|
||||
|
||||
console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Events ▬▬▬▬▬▬▬");
|
||||
if (process.argv[2] !== "test") {
|
||||
await this.login(token);
|
||||
} else {
|
||||
console.log(
|
||||
`\u001b[31;1m`,
|
||||
"RUNNING IN TEST MODE, IF NOT INTENDED, PLEASE USE npm start"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Client;
|
||||
@@ -0,0 +1,14 @@
|
||||
// SupportBot | Emerald Services
|
||||
// Command Structure
|
||||
|
||||
class Command {
|
||||
constructor(options) {
|
||||
this.name = options.name;
|
||||
this.description = options.description;
|
||||
this.permissions = options.permissions || [];
|
||||
this.options = options.options || [];
|
||||
this.run = options.run;
|
||||
this.defaultPermission = true;
|
||||
}
|
||||
}
|
||||
module.exports = Command;
|
||||
@@ -0,0 +1,10 @@
|
||||
// SupportBot | Emerald Services
|
||||
// Event Structure
|
||||
class Event {
|
||||
constructor(event, run) {
|
||||
this.event = event;
|
||||
this.run = run;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Event;
|
||||
@@ -0,0 +1,47 @@
|
||||
// SupportBot | Emerald Services
|
||||
// Ticket ID Structure
|
||||
|
||||
const fs = require("fs");
|
||||
|
||||
class TicketNumberID {
|
||||
static async pad() {
|
||||
let num = await this.get();
|
||||
let n = num + "";
|
||||
await this.set(num + 1);
|
||||
return n.length >= 4 ? n : new Array(4 - n.length + 1).join("0") + n;
|
||||
}
|
||||
|
||||
static async get() {
|
||||
let ticketnumberID = await JSON.parse(
|
||||
fs.readFileSync("./Data/ticket-panel-id.json", "utf8")
|
||||
);
|
||||
if (!ticketnumberID.id) {
|
||||
return this.set(0);
|
||||
} else {
|
||||
return ticketnumberID.id;
|
||||
}
|
||||
}
|
||||
|
||||
static async set(value) {
|
||||
let ticketnumberID = await JSON.parse(
|
||||
fs.readFileSync("./Data/ticket-panel-id.json", "utf8")
|
||||
);
|
||||
|
||||
ticketnumberID.id = value;
|
||||
fs.writeFileSync(
|
||||
"./Data/ticket-panel-id.json",
|
||||
JSON.stringify(ticketnumberID, null, 4),
|
||||
(err) => {
|
||||
if (err) console.error(err);
|
||||
}
|
||||
);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
static async reset() {
|
||||
return await this.set(0);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = TicketNumberID;
|
||||
@@ -1,20 +0,0 @@
|
||||
// SupportBot, Created by Emerald Services
|
||||
// Help Command
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
|
||||
// location for the addons configuration, to keep it simple we generate a settings folder within the addons directory.
|
||||
const example = yaml.load(fs.readFileSync('./addons/settings/exampleaddon.yml', 'utf8'));
|
||||
|
||||
module.exports = {
|
||||
name: example.ExampleAddonCommand,
|
||||
description: example.ExampleAddonDesc,
|
||||
|
||||
execute(message, args) {
|
||||
if (supportbot.DeleteMessages == "true") message.delete();
|
||||
message.channel.send(example.ExampleAddonMessage)
|
||||
}
|
||||
};
|
||||
@@ -1,9 +0,0 @@
|
||||
#
|
||||
# SupportBot, Created by Emerald Services
|
||||
# Example Addon
|
||||
#
|
||||
|
||||
ExampleAddonCommand: "exampleaddon"
|
||||
ExampleAddonDesc: "This is the default/example addon for SupportBot."
|
||||
|
||||
ExampleAddonMessage: "> :white_check_mark: This is the **default** addon for SupportBot. You can download addons from our website, https://emeraldservices.xyz/"
|
||||
@@ -1,64 +0,0 @@
|
||||
// SupportBot, Created by Emerald Services
|
||||
// Add User
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = {
|
||||
name: supportbot.AddUser,
|
||||
description: supportbot.AddUserDesc,
|
||||
|
||||
execute(message, args) {
|
||||
if (supportbot.DeleteMessages) message.delete();
|
||||
|
||||
let SupportStaff = message.guild.roles.cache.find(SupportTeam => SupportTeam.name === supportbot.Staff) || message.guild.roles.cache.find(SupportTeam => SupportTeam.id === supportbot.Staff)
|
||||
let Admins = message.guild.roles.cache.find(AdminUser => AdminUser.name === supportbot.Admin) || message.guild.roles.cache.find(AdminUser => AdminUser.id === supportbot.Admin)
|
||||
|
||||
const NoPerms = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Permissions!")
|
||||
.setDescription(`${supportbot.IncorrectPerms}\n\nRole Required: \`${supportbot.Staff}\` or \`${supportbot.Admin}\``)
|
||||
.setColor(supportbot.WarningColour)
|
||||
|
||||
if (message.member.roles.cache.has(SupportStaff.id) || message.member.roles.cache.has(Admins.id)) {
|
||||
if (!message.channel.name.startsWith( `${supportbot.TicketChannel}-` )) {
|
||||
const Exists = new Discord.MessageEmbed()
|
||||
.setTitle("No Ticket Found!")
|
||||
.setDescription(`${supportbot.NoValidTicket}`)
|
||||
.setColor(supportbot.WarningColour);
|
||||
message.channel.send({ embed: Exists });
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
let rUser = message.guild.member(message.mentions.users.first() || message.guild.members.cache.get(args[0]));
|
||||
const UserNotExist = new Discord.MessageEmbed()
|
||||
.setTitle("User Not Found!")
|
||||
.setDescription(`${supportbot.UserNotFound}\n\nTry Again:\`${supportbot.Prefix}${supportbot.AddUser} <user#0000>\``)
|
||||
.setColor(supportbot.ErrorColour)
|
||||
|
||||
if (!rUser) return message.channel.send({ embed: UserNotExist });
|
||||
|
||||
message.channel.updateOverwrite(rUser, {
|
||||
VIEW_CHANNEL: true,
|
||||
CREATE_INVITE: false,
|
||||
SEND_MESSAGES: true,
|
||||
READ_MESSAGES: true
|
||||
});
|
||||
|
||||
const Complete = new Discord.MessageEmbed()
|
||||
.setTitle("User Added!")
|
||||
.setDescription(supportbot.AddedUser.replace(/%user%/g, rUser.id))
|
||||
.setTimestamp()
|
||||
.setColor(supportbot.EmbedColour)
|
||||
message.channel.send({ embed: Complete });
|
||||
} else {
|
||||
|
||||
return message.channel.send({ embed: NoPerms });
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
@@ -1,71 +0,0 @@
|
||||
// SupportBot, Created by Emerald Services
|
||||
// Announce
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const { execute } = require("./help");
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = {
|
||||
name: supportbot.AnnounceCommand,
|
||||
description: supportbot.AnnounceDesc,
|
||||
|
||||
execute(message, args) {
|
||||
|
||||
if (supportbot.DeleteMessages) message.delete();
|
||||
|
||||
let locateChannel = message.guild.channels.cache.find(AnnouncementChannel => AnnouncementChannel.name === supportbot.AnnouncementChannel) || message.guild.channels.cache.find(AnnouncementChannel => AnnouncementChannel.id === supportbot.AnnouncementChannel)
|
||||
|
||||
const errornochannel = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Channel")
|
||||
.setDescription(`${supportbot.InvalidChannel}\n\nChannel Required: \`${supportbot.AnnouncementChannel}`)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
|
||||
if(!locateChannel) return message.channel.send({ embed: errornochannel });
|
||||
|
||||
let Admins = message.guild.roles.cache.find(adminRole => adminRole.name === supportbot.Admin) || message.guild.roles.cache.find(adminRole => adminRole.id === supportbot.Admin)
|
||||
|
||||
const NoPerms = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Permissions!")
|
||||
.setDescription(`${supportbot.IncorrectPerms}\n\nRole Required: \`${Admins.name}\``)
|
||||
.setColor(supportbot.WarningColour)
|
||||
|
||||
if (!message.member.roles.cache.has(Admins.id))
|
||||
return message.channel.send({ embed: NoPerms });
|
||||
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setDescription(`> **${supportbot.AnnouncementStarter}**`)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
message.channel.send({ embed: embed });
|
||||
|
||||
let announcement = []
|
||||
message.channel.awaitMessages(response => response.content.length > 2, {
|
||||
max: 1,
|
||||
time: 500000,
|
||||
errors: ['time'],
|
||||
}).then((collected) => {
|
||||
announcement.push(collected.map(r => r.content));
|
||||
|
||||
locateChannel.send('@everyone')
|
||||
const AnnouncementEmbed = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.AnnouncementTitle)
|
||||
.setThumbnail(supportbot.AnnouncementIcon)
|
||||
.setDescription(announcement)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter(supportbot.EmbedFooter, message.author.displayAvatarURL());
|
||||
|
||||
locateChannel.send({ embed: AnnouncementEmbed }).then(async function(msg) {
|
||||
const AnnouncementComplete = new Discord.MessageEmbed()
|
||||
.setColor(supportbot.SuccessColour)
|
||||
.setDescription(`:white_check_mark: You have successfully created an announcement. <#${locateChannel.id}>`)
|
||||
message.channel.send({ embed: AnnouncementComplete })
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
-108
@@ -1,108 +0,0 @@
|
||||
// SupportBot, Created by Emerald Services
|
||||
// Say Command
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const { execute } = require("./help");
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = {
|
||||
name: supportbot.BanUser,
|
||||
description: supportbot.BanDesc,
|
||||
|
||||
execute(message, args, member) {
|
||||
if (supportbot.DeleteMessages) message.delete();
|
||||
|
||||
let SupportStaff = message.guild.roles.cache.find(adminRole => adminRole.name === supportbot.Admin) || message.guild.roles.cache.find(adminRole => adminRole.id === supportbot.Admin)
|
||||
|
||||
const NoPerms = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Permissions!")
|
||||
.setDescription(`${supportbot.IncorrectPerms}\n\nRole Required: \`${SupportStaff.name}\``)
|
||||
.setColor(supportbot.WarningColour)
|
||||
|
||||
if (!message.member.roles.cache.has(SupportStaff.id))
|
||||
return message.channel.send({ embed: NoPerms });
|
||||
|
||||
let locateChannel = message.guild.channels.cache.find(ModLogChannel => ModLogChannel.name === supportbot.ModLogChannel) || message.guild.channels.cache.find(ModLogChannel => ModLogChannel.id === supportbot.ModLogChannel)
|
||||
|
||||
const errornochannel = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Channel")
|
||||
.setDescription(`${supportbot.InvalidChannel}\n\nChannel Required: \`${supportbot.ModLogChannel}\``)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
|
||||
if(!locateChannel) return message.channel.send({ embed: errornochannel });
|
||||
|
||||
const user = message.mentions.members.first() || message.guild.members.cache.get(args[0]);
|
||||
|
||||
const embed1 = new Discord.MessageEmbed()
|
||||
.setDescription("> :x: Please provide a reason to ban.\n\n`Try Again!`")
|
||||
.setColor(supportbot.ErrorColour)
|
||||
|
||||
if (!args[0]) return message.channel.send({
|
||||
embed: embed1
|
||||
});
|
||||
|
||||
const embed2 = new Discord.MessageEmbed()
|
||||
.setDescription("> :detective: **Hmm!** Can\'t seem tp find this user.\n\n`Are they in the server?`")
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
if (!user) return message.channel.send({
|
||||
embed: embed2
|
||||
})
|
||||
|
||||
const embed3 = new Discord.MessageEmbed()
|
||||
.setDescription("> :x: **Err No!** Cannot punish this user!\n\n`Reason: Their permissions and or roles are greater than mine.`")
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
if(!user.bannable) return message.channel.send({
|
||||
embed: embed3
|
||||
});
|
||||
|
||||
const embed4 = new Discord.MessageEmbed()
|
||||
.setDescription("> :joy: **OML!** Did you really just try to ban yourself!")
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
if(user.id === message.author.id) return message.channel.send({
|
||||
embed: embed4
|
||||
});
|
||||
|
||||
let reason = args.slice(1).join(" ");
|
||||
|
||||
if(!reason) reason = 'No Reason Provided.';
|
||||
|
||||
const embed5 = new Discord.MessageEmbed()
|
||||
.setDescription("> :thinking: **Hmm** Something seems to have gone wrong.\n\n`Check your system for errors!`")
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
user.ban({ days: supportbot.DaysBannedFor, reason: `${reason}` }).catch(err => {
|
||||
message.channel.send({ embed: embed5 })
|
||||
console.log(err)
|
||||
})
|
||||
|
||||
|
||||
const successEmbed = new Discord.MessageEmbed()
|
||||
.setDescription(`> :white_check_mark: **OOF!** ${user} has been banned!`)
|
||||
.setColor(supportbot.SuccessColour)
|
||||
message.channel.send({
|
||||
embed: successEmbed
|
||||
})
|
||||
|
||||
const logEmbed = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.BanTitle)
|
||||
.setThumbnail(supportbot.ModThumbnail)
|
||||
.addField('Banned User:', user)
|
||||
.addField('Staff Member', message.author)
|
||||
.addField('Reason:', reason)
|
||||
.setFooter(supportbot.EmbedFooter)
|
||||
.setColor(supportbot.BanLogColour)
|
||||
.setTimestamp()
|
||||
|
||||
locateChannel.send({ embed: logEmbed })
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
@@ -1,100 +0,0 @@
|
||||
// SupportBot, Created by Emerald Services
|
||||
// Blacklist Command
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const { execute } = require("./help");
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = {
|
||||
name: supportbot.BlacklistUser,
|
||||
description: supportbot.BlacklistDesc,
|
||||
|
||||
execute(message, args) {
|
||||
if (supportbot.DeleteMessages) message.delete();
|
||||
|
||||
let SupportStaff = message.guild.roles.cache.find(adminRole => adminRole.name === supportbot.Admin) || message.guild.roles.cache.find(adminRole => adminRole.id === supportbot.Admin)
|
||||
|
||||
const NoPerms = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Permissions!")
|
||||
.setDescription(`${supportbot.IncorrectPerms}\n\nRole Required: \`${SupportStaff.name}\``)
|
||||
.setColor(supportbot.WarningColour)
|
||||
|
||||
if (!message.member.roles.cache.has(SupportStaff.id)) {
|
||||
return message.channel.send({ embed: NoPerms });
|
||||
}
|
||||
|
||||
let locateChannel = message.guild.channels.cache.find(ModLogChannel => ModLogChannel.name === supportbot.ModLogChannel) || message.guild.channels.cache.find(ModLogChannel => ModLogChannel.id === supportbot.ModLogChannel)
|
||||
|
||||
const user = message.mentions.members.first() || message.guild.members.cache.get(args[0]);
|
||||
|
||||
const errornochannel = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Channel")
|
||||
.setDescription(`${supportbot.InvalidChannel}\n\nChannel Required: \`${supportbot.ModLogChannel}\``)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
|
||||
if(!locateChannel) return message.channel.send({ embed: errornochannel });
|
||||
|
||||
const embed1 = new Discord.MessageEmbed()
|
||||
.setDescription("> :x: Please mention or write an ID\n\n`Try Again!`")
|
||||
.setColor(supportbot.ErrorColour)
|
||||
|
||||
if (!args[0]) return message.channel.send({
|
||||
embed: embed1
|
||||
});
|
||||
|
||||
const embed2 = new Discord.MessageEmbed()
|
||||
.setDescription("> :detective: **Hmm!** Can\'t seem tp find this user.\n\n`Are they in the server?`")
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
if (!user) return message.channel.send({
|
||||
embed: embed2
|
||||
});
|
||||
|
||||
let role = message.guild.roles.cache.find(role => role.name === supportbot.TicketBlackListRole) || message.guild.roles.cache.find(role => role.id === supportbot.TicketBlackListRole)
|
||||
|
||||
const embed3 = new Discord.MessageEmbed()
|
||||
.setDescription("> :detective: **Hmm!** Can\'t seem to find the blacklist role.\n\n`Did you created it?")
|
||||
.setColor(supportbot.ErrorColour)
|
||||
|
||||
|
||||
if (!role) return message.channel.send({
|
||||
embed: embed3
|
||||
});
|
||||
|
||||
const embed4 = new Discord.MessageEmbed()
|
||||
.setDescription(`${user} is already blacklisted`)
|
||||
.setColor(supportbot.ErrorColour)
|
||||
|
||||
if(user.roles.cache.find(role => role.name === supportbot.TicketBlackListRole) || user.roles.cache.find(role => role.id === supportbot.TicketBlackListRole)) {
|
||||
return message.channel.send({
|
||||
embed: embed4
|
||||
})
|
||||
};
|
||||
|
||||
user.roles.add(role);
|
||||
|
||||
const embed5 = new Discord.MessageEmbed()
|
||||
.setDescription(`Blacklisted ${user} successfully from creating a ticket`)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
message.channel.send({
|
||||
embed: embed5
|
||||
});
|
||||
|
||||
const logEmbed = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.BlacklistTitle)
|
||||
.setThumbnail(supportbot.ModThumbnail)
|
||||
.addField('Banned User:', user)
|
||||
.addField('Staff Member', message.author)
|
||||
.setFooter(supportbot.EmbedFooter)
|
||||
.setColor(supportbot.BlacklistColour)
|
||||
.setTimestamp()
|
||||
|
||||
locateChannel.send({ embed: logEmbed });
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
@@ -1,51 +0,0 @@
|
||||
// SupportBot, Created by Emerald Services
|
||||
// Say Command
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const { execute } = require("./help");
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = {
|
||||
name: supportbot.BotSay,
|
||||
description: supportbot.BotSayDesc,
|
||||
|
||||
execute(message, args) {
|
||||
if (supportbot.DeleteMessages) message.delete();
|
||||
|
||||
let SupportStaff = message.guild.roles.cache.find(adminRole => adminRole.name === supportbot.Staff) || message.guild.roles.cache.find(adminRole => adminRole.id === supportbot.Staff)
|
||||
|
||||
const NoPerms = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Permissions!")
|
||||
.setDescription(`${supportbot.IncorrectPerms}\n\nRole Required: \`${SupportStaff.name}\``)
|
||||
.setColor(supportbot.WarningColour)
|
||||
|
||||
if (!message.member.roles.cache.has(SupportStaff.id))
|
||||
return message.channel.send({ embed: NoPerms });
|
||||
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setDescription(`> **What would you like me to say!**`)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
message.channel.send({ embed: embed });
|
||||
|
||||
let announcement = []
|
||||
message.channel.awaitMessages(response => response.content.length > 2, {
|
||||
max: 1,
|
||||
time: 500000,
|
||||
errors: ['time'],
|
||||
}).then((collected) => {
|
||||
announcement.push(collected.map(r => r.content));
|
||||
|
||||
const AnnouncementEmbed = new Discord.MessageEmbed()
|
||||
.setDescription(announcement)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
message.channel.send({ embed: AnnouncementEmbed })
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
@@ -1,147 +0,0 @@
|
||||
// SupportBot, Created by Emerald Services
|
||||
// Close Command
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const { execute } = require("./help");
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = {
|
||||
name: supportbot.CloseTicket,
|
||||
description: supportbot.CloseTicketDesc,
|
||||
|
||||
execute(message, args) {
|
||||
if (supportbot.DeleteMessages) message.delete();
|
||||
|
||||
if (!message.channel.name.startsWith( `${supportbot.TicketChannel}-` )) {
|
||||
const Exists = new Discord.MessageEmbed()
|
||||
.setTitle("No Ticket Found!")
|
||||
.setDescription(`${supportbot.NoValidTicket}`)
|
||||
.setColor(supportbot.WarningColour);
|
||||
message.channel.send({ embed: Exists });
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (supportbot.CloseConfirmation) {
|
||||
const CloseTicketRequest = new Discord.MessageEmbed()
|
||||
.setTitle(`**${supportbot.ClosingTicket}**`)
|
||||
.setDescription(`Please confirm by repeating the following word.. \`${supportbot.ClosingConfirmation_Word}\` `)
|
||||
.setColor(supportbot.EmbedColour);
|
||||
|
||||
message.channel.send(CloseTicketRequest).then(m => {
|
||||
message.channel.awaitMessages( response => response.content.toLowerCase() === supportbot.ClosingConfirmation_Word, {
|
||||
max: 1,
|
||||
time: 20000,
|
||||
errors: [ 'time' ],
|
||||
|
||||
|
||||
}).then( collected => {
|
||||
let logChannel = message.guild.channels.cache.find(channel => channel.name === supportbot.TranscriptLog) || message.guild.channels.cache.find(channel => channel.id === supportbot.TranscriptLog)
|
||||
let user = message.author;
|
||||
let reason = args.join(" ") || "No Reason Provided.";
|
||||
|
||||
let name = message.channel.name;
|
||||
let ticketChannel = message.channel;
|
||||
|
||||
message.channel.send(`**${supportbot.ClosingTicket}**`)
|
||||
|
||||
.then(() => {
|
||||
const logEmbed = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.TranscriptTitle)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter(supportbot.EmbedFooter)
|
||||
.addField("Closed By", message.author.tag)
|
||||
.addField("Reason", reason);
|
||||
|
||||
message.channel.messages.fetch({ limit: 100 }).then( msgs => {
|
||||
let html = '';
|
||||
|
||||
msgs = msgs.sort( ( a, b ) => a.createdTimestamp - b.createdTimestamp );
|
||||
html += `<strong>Server Name:</strong> ${message.guild.name}<br>`;
|
||||
html += `<strong>Ticket:</strong> ${ticketChannel.name}<br>`;
|
||||
html += `<strong>Message:</strong> ${msgs.size} Messages<br><br><br>`;
|
||||
|
||||
msgs.forEach( msg => {
|
||||
if ( msg.content ) {
|
||||
html += `<strong>User:</strong> ${msg.author.tag}<br>`;
|
||||
html += `<strong>Message:</strong> ${msg.content}<br>`;
|
||||
html += `-----<br><br>`;
|
||||
}
|
||||
});
|
||||
|
||||
logChannel.send(logEmbed).catch(err => {
|
||||
message.reply(err)
|
||||
})
|
||||
|
||||
logChannel.send( new Discord.MessageAttachment( Buffer.from( html ), `${name}.html` ) );
|
||||
|
||||
message.channel.delete();
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
}).catch( () => {
|
||||
m.edit('The request to close the ticket has timed out.').then( m2 => m2.delete( 3000 ) );
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
if (!supportbot.CloseConfirmation) {
|
||||
|
||||
let logChannel = message.guild.channels.cache.find(channel => channel.name === supportbot.TranscriptLog) || message.guild.channels.cache.find(channel => channel.id === supportbot.TranscriptLog)
|
||||
let user = message.author;
|
||||
let reason = args.join(" ") || "No Reason Provided.";
|
||||
|
||||
let name = message.channel.name;
|
||||
let ticketChannel = message.channel;
|
||||
|
||||
message.channel.send(`**${supportbot.ClosingTicket}**`)
|
||||
|
||||
.then(() => {
|
||||
const logEmbed = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.TranscriptTitle)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter(supportbot.EmbedFooter)
|
||||
.addField("Closed By", message.author.tag)
|
||||
.addField("Reason", reason);
|
||||
|
||||
message.channel.messages.fetch({ limit: 100 }).then( msgs => {
|
||||
let html = '';
|
||||
|
||||
msgs = msgs.sort( ( a, b ) => a.createdTimestamp - b.createdTimestamp );
|
||||
html += `<strong>Server Name:</strong> ${message.guild.name}<br>`;
|
||||
html += `<strong>Ticket:</strong> ${ticketChannel.name}<br>`;
|
||||
html += `<strong>Message:</strong> ${msgs.size} Messages<br><br><br>`;
|
||||
|
||||
msgs.forEach( msg => {
|
||||
if ( msg.content ) {
|
||||
html += `<strong>User:</strong> ${msg.author.tag}<br>`;
|
||||
html += `<strong>Message:</strong> ${msg.content}<br>`;
|
||||
html += `-----<br><br>`;
|
||||
}
|
||||
});
|
||||
|
||||
logChannel.send(logEmbed).catch(err => {
|
||||
message.reply(err)
|
||||
})
|
||||
|
||||
logChannel.send( new Discord.MessageAttachment( Buffer.from( html ), `${name}.html` ) );
|
||||
|
||||
message.channel.delete();
|
||||
|
||||
})
|
||||
|
||||
}).catch( () => {
|
||||
m.edit('The request to close the ticket has timed out.').then( m2 => m2.delete( 3000 ) );
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
@@ -1,84 +0,0 @@
|
||||
// SupportBot, Created by Emerald Services
|
||||
// Help Command
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = {
|
||||
name: supportbot.HelpCommand,
|
||||
description: supportbot.HelpDesc,
|
||||
|
||||
execute(message, args) {
|
||||
if (supportbot.DeleteMessages) message.delete();
|
||||
|
||||
let SupportStaff = message.guild.roles.cache.find(adminRole => adminRole.name === supportbot.Staff) || message.guild.roles.cache.find(staffRole => staffRole.id === supportbot.Staff);
|
||||
let AdminStaff = message.guild.roles.cache.find(adminRole => adminRole.name === supportbot.Admin) || message.guild.roles.cache.find(adminRole => adminRole.id === supportbot.Admin);
|
||||
|
||||
if (supportbot.HelpMenu) {
|
||||
let generalCommands = "";
|
||||
generalCommands += `**${supportbot.Prefix}${supportbot.HelpCommand}** ${supportbot.HelpDesc}\n`;
|
||||
generalCommands += `**${supportbot.Prefix}${supportbot.LinksCommand}** ${supportbot.LinksDesc}\n`;
|
||||
generalCommands += `**${supportbot.Prefix}${supportbot.SuggestCommand}** ${supportbot.SuggestionDesc}\n`;
|
||||
generalCommands += `**${supportbot.Prefix}${supportbot.PingCommand}** ${supportbot.PingDesc}\n`;
|
||||
|
||||
let supportCommands = "";
|
||||
supportCommands += `**${supportbot.Prefix}${supportbot.NewTicket} [reason]** ${supportbot.NewTicketDesc}\n`
|
||||
supportCommands += `**${supportbot.Prefix}${supportbot.CloseTicket} [reason]** ${supportbot.CloseTicketDesc}\n`
|
||||
|
||||
let staffCommands = "";
|
||||
staffCommands += `**${supportbot.Prefix}${supportbot.AddUser} <user#0000>** ${supportbot.AddUserDesc}\n`
|
||||
staffCommands += `**${supportbot.Prefix}${supportbot.RemoveUser} <user#0000>** ${supportbot.RemoveUserDesc}\n`
|
||||
staffCommands += `**${supportbot.Prefix}${supportbot.BotSay}** ${supportbot.BotSayDesc}\n`
|
||||
staffCommands += `**${supportbot.Prefix}${supportbot.PurgeMessage}** ${supportbot.PurgeDesc}\n`
|
||||
staffCommands += `**${supportbot.Prefix}${supportbot.ChatLog}** ${supportbot.ChatLogDesc}\n`
|
||||
|
||||
let adminCommands = "";
|
||||
adminCommands += `**${supportbot.Prefix}${supportbot.AnnounceCommand}** ${supportbot.AnnounceDesc} \`Admin Only\`\n`
|
||||
adminCommands += `**${supportbot.Prefix}${supportbot.BanUser}** ${supportbot.BanDesc} \`Admin Only\` \n`
|
||||
adminCommands += `**${supportbot.Prefix}${supportbot.KickUser}** ${supportbot.KickDesc} \`Admin Only\` \n`
|
||||
adminCommands += `**${supportbot.Prefix}${supportbot.BlacklistUser}** ${supportbot.BlacklistDesc} \`Admin Only\` \n`
|
||||
|
||||
const HelpEmbed1 = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.Bot_Name)
|
||||
.setThumbnail(message.author.displayAvatarURL())
|
||||
|
||||
.addFields(
|
||||
{ name: '🖥️ General Commands\n', value: `${generalCommands}\n`, inline: false },
|
||||
{ name: '🎫 Support Commands\n', value: `${supportCommands}\n`, inline: false },
|
||||
)
|
||||
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter(supportbot.EmbedFooter, message.author.displayAvatarURL());
|
||||
|
||||
if (message.member.roles.cache.has(SupportStaff.id)) {
|
||||
HelpEmbed1.addFields(
|
||||
{ name: '🔐 Staff Commands\n', value: `${staffCommands}\n`, inline: false },
|
||||
)
|
||||
}
|
||||
|
||||
if (message.member.roles.cache.has(AdminStaff.id)) {
|
||||
HelpEmbed1.addFields(
|
||||
{ name: '🔐 Admin Commands\n', value: `${adminCommands}\n`, inline: false },
|
||||
)
|
||||
}
|
||||
|
||||
if (supportbot.SendHelpPage === "dm") {
|
||||
message.author.send({
|
||||
embed: HelpEmbed1
|
||||
});
|
||||
}
|
||||
|
||||
if (supportbot.SendHelpPage === "channel") {
|
||||
message.channel.send({
|
||||
embed: HelpEmbed1
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
@@ -1,109 +0,0 @@
|
||||
// SupportBot, Created by Emerald Services
|
||||
// Say Command
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const { execute } = require("./help");
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = {
|
||||
name: supportbot.KickUser,
|
||||
description: supportbot.KickDesc,
|
||||
|
||||
execute(message, args, member) {
|
||||
if (supportbot.DeleteMessages) message.delete();
|
||||
|
||||
let SupportStaff = message.guild.roles.cache.find(adminRole => adminRole.name === supportbot.Admin) || message.guild.roles.cache.find(adminRole => adminRole.id === supportbot.Admin)
|
||||
|
||||
const NoPerms = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Permissions!")
|
||||
.setDescription(`${supportbot.IncorrectPerms}\n\nRole Required: \`${SupportStaff.name}\``)
|
||||
.setColor(supportbot.WarningColour)
|
||||
|
||||
if (!message.member.roles.cache.has(SupportStaff.id))
|
||||
return message.channel.send({ embed: NoPerms });
|
||||
|
||||
let locateChannel = message.guild.channels.cache.find(ModLogChannel => ModLogChannel.name === supportbot.ModLogChannel) || message.guild.channels.cache.find(ModLogChannel => ModLogChannel.id === supportbot.ModLogChannel)
|
||||
|
||||
const errornochannel = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Channel")
|
||||
.setDescription(`${supportbot.InvalidChannel}\n\nChannel Required: \`${supportbot.ModLogChannel}\``)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
|
||||
if(!locateChannel) return message.channel.send({ embed: errornochannel });
|
||||
|
||||
const user = message.mentions.members.first() || message.guild.members.cache.get(args[0]);
|
||||
|
||||
const embed1 = new Discord.MessageEmbed()
|
||||
.setDescription("> :x: Please provide a reason to kick.\n\n`Try Again!`")
|
||||
.setColor(supportbot.ErrorColour)
|
||||
|
||||
if (!args[0]) return message.channel.send({
|
||||
embed: embed1
|
||||
});
|
||||
|
||||
const embed2 = new Discord.MessageEmbed()
|
||||
.setDescription("> :detective: **Hmm!** Can\'t seem tp find this user.\n\n`Are they in the server?`")
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
if (!user) return message.channel.send({
|
||||
embed: embed2
|
||||
})
|
||||
|
||||
const embed3 = new Discord.MessageEmbed()
|
||||
.setDescription("> :x: **Err No!** Cannot punish this user!\n\n`Reason: Their permissions and or roles are greater than mine.`")
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
if(!user.kickable) return message.channel.send({
|
||||
embed: embed3
|
||||
});
|
||||
|
||||
const embed4 = new Discord.MessageEmbed()
|
||||
.setDescription("> :joy: **OML!** Did you really just try to kick yourself!")
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
if(user.id === message.author.id) return message.channel.send({
|
||||
embed: embed4
|
||||
});
|
||||
|
||||
let reason = args.slice(1).join(" ");
|
||||
|
||||
if(!reason) reason = 'No Reason Provided.';
|
||||
|
||||
const embed5 = new Discord.MessageEmbed()
|
||||
.setDescription("> :thinking: **Hmm** Something seems to have gone wrong.\n\n`Check your system for errors!`")
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
user.kick({ reason: `${reason}` }).catch(err => {
|
||||
message.channel.send({ embed: embed5 })
|
||||
console.log(err)
|
||||
})
|
||||
|
||||
|
||||
const successEmbed = new Discord.MessageEmbed()
|
||||
.setDescription(`> :white_check_mark: **OOF!** ${user} has been kicked!`)
|
||||
.setColor(supportbot.SuccessColour)
|
||||
|
||||
message.channel.send({
|
||||
embed: successEmbed
|
||||
})
|
||||
|
||||
const logEmbed = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.KickTitle)
|
||||
.setThumbnail(supportbot.ModThumbnail)
|
||||
.addField('Kicked User:', user)
|
||||
.addField('Staff Member', message.author)
|
||||
.addField('Reason:', reason)
|
||||
.setFooter(supportbot.EmbedFooter)
|
||||
.setColor(supportbot.KickLogColour)
|
||||
.setTimestamp()
|
||||
|
||||
locateChannel.send({ embed: logEmbed })
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
@@ -1,34 +0,0 @@
|
||||
// SupportBot, Created by Emerald Services
|
||||
// Links Command
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const { execute } = require("./help");
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = {
|
||||
name: supportbot.LinksCommand,
|
||||
description: supportbot.LinksDesc,
|
||||
|
||||
execute(message, args) {
|
||||
if (supportbot.DeleteMessages) message.delete();
|
||||
|
||||
const LinksEmbed = new Discord.MessageEmbed()
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
let botLinks = supportbot.LINKS;
|
||||
|
||||
let links = '';
|
||||
|
||||
for ( let name in botLinks ) {
|
||||
links += `[${name}](${botLinks[ name ]})\n`;
|
||||
};
|
||||
|
||||
LinksEmbed.addField(supportbot.LinksTitle, links)
|
||||
|
||||
message.channel.send({ embed: LinksEmbed });
|
||||
|
||||
}
|
||||
};
|
||||
@@ -1,25 +0,0 @@
|
||||
// SupportBot, Created by Emerald Services
|
||||
// Ping Command
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = {
|
||||
name: supportbot.PingCommand,
|
||||
description: supportbot.PingDesc,
|
||||
|
||||
execute(message, args) {
|
||||
if (supportbot.DeleteMessages) message.delete();
|
||||
|
||||
let ping = Date.now() - message.createdTimestamp + " ms";
|
||||
|
||||
const PingCommandEmbed = new Discord.MessageEmbed()
|
||||
.setDescription(`🏓 **Pong!** \`${Date.now() - message.createdTimestamp}ms\``)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
message.channel.send({ embed: PingCommandEmbed });
|
||||
}
|
||||
};
|
||||
@@ -1,80 +0,0 @@
|
||||
// SupportBot, Created by Emerald Services
|
||||
// Say Command
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const { execute } = require("./help");
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = {
|
||||
name: supportbot.PurgeMessage,
|
||||
description: supportbot.PurgeDesc,
|
||||
|
||||
execute(message, args, member) {
|
||||
if (supportbot.DeleteMessages) message.delete();
|
||||
|
||||
let SupportStaff = message.guild.roles.cache.find(adminRole => adminRole.name === supportbot.Staff) || message.guild.roles.cache.find(adminRole => adminRole.id === supportbot.Staff)
|
||||
|
||||
const NoPerms = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Permissions!")
|
||||
.setDescription(`${supportbot.IncorrectPerms}\n\nRole Required: \`${SupportStaff.name}\``)
|
||||
.setColor(supportbot.WarningColour)
|
||||
|
||||
if (!message.member.roles.cache.has(SupportStaff.id))
|
||||
return message.channel.send({ embed: NoPerms });
|
||||
|
||||
let locateChannel = message.guild.channels.cache.find(ModLogChannel => ModLogChannel.name === supportbot.ModLogChannel) || message.guild.channels.cache.find(ModLogChannel => ModLogChannel.id === supportbot.ModLogChannel)
|
||||
|
||||
const errornochannel = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Channel")
|
||||
.setDescription(`${supportbot.InvalidChannel}\n\nChannel Required: \`${supportbot.ModLogChannel}\``)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
|
||||
if(!locateChannel) return message.channel.send({ embed: errornochannel });
|
||||
|
||||
const embed1 = new Discord.MessageEmbed()
|
||||
.setDescription(`> :thinking: **Hmm!** Please enter a valid number of message to purge!\n\n\`${supportbot.Prefix}${supportbot.PurgeMessage} <message count>\` `)
|
||||
.setColor(supportbot.WarningColour)
|
||||
|
||||
if (!args[0]) return message.channel.send({
|
||||
embed: embed1
|
||||
});
|
||||
|
||||
const messagePrune = parseInt(args[0])
|
||||
|
||||
const embed2 = new Discord.MessageEmbed()
|
||||
.setDescription("> :person_facepalming: **Grr!** Can you count? That ain't a number :joy:")
|
||||
.setColor(supportbot.ErrorColour)
|
||||
|
||||
if (isNaN(messagePrune)) return message.reply({
|
||||
embed: embed2
|
||||
})
|
||||
|
||||
message.channel.bulkDelete(messagePrune).then(() => {
|
||||
|
||||
const embed3 = new Discord.MessageEmbed()
|
||||
.setDescription(`> :recycle: \`${args[0]} messages\` **have been purged!** `)
|
||||
.setColor(supportbot.ErrorColour)
|
||||
message.channel.send({
|
||||
embed: embed3
|
||||
})
|
||||
})
|
||||
|
||||
const logEmbed = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.PruneLogTitle)
|
||||
.setThumbnail(supportbot.PruneThumbnail)
|
||||
.addField('Messages Purged', `\`${args[0]} messages\``)
|
||||
.addField('Staff Member', message.author)
|
||||
.setFooter(supportbot.EmbedFooter)
|
||||
.setColor(supportbot.PruneColour)
|
||||
.setTimestamp()
|
||||
|
||||
locateChannel.send({ embed: logEmbed })
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
@@ -1,62 +0,0 @@
|
||||
// SupportBot, Created by Emerald Services
|
||||
// Remove User
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = {
|
||||
name: supportbot.RemoveUser,
|
||||
description: supportbot.RemoveUserDesc,
|
||||
|
||||
execute(message, args) {
|
||||
if (supportbot.DeleteMessages) message.delete();
|
||||
|
||||
let SupportStaff = message.guild.roles.cache.find(SupportTeam => SupportTeam.name === supportbot.Staff) || message.guild.roles.cache.find(SupportTeam => SupportTeam.id === supportbot.Staff)
|
||||
let Admins = message.guild.roles.cache.find(AdminUser => AdminUser.name === supportbot.Admin) || message.guild.roles.cache.find(AdminUser => AdminUser.id === supportbot.Admin)
|
||||
|
||||
const NoPerms = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Permissions!")
|
||||
.setDescription(`${supportbot.IncorrectPerms}\n\nRole Required: \`${supportbot.Staff}\` or \`${supportbot.Admin}\``)
|
||||
.setColor(supportbot.WarningColour)
|
||||
|
||||
if (message.member.roles.cache.has(SupportStaff.id) || message.member.roles.cache.has(Admins.id)) {
|
||||
if (!message.channel.name.startsWith( `${supportbot.TicketChannel}-` )) {
|
||||
const Exists = new Discord.MessageEmbed()
|
||||
.setTitle("No Ticket Found!")
|
||||
.setDescription(`${supportbot.NoValidTicket}`)
|
||||
.setColor(supportbot.WarningColour);
|
||||
message.channel.send({ embed: Exists });
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
let rUser = message.guild.member(message.mentions.users.first() || message.guild.members.cache.get(args[0]));
|
||||
const UserNotExist = new Discord.MessageEmbed()
|
||||
.setTitle("User Not Found!")
|
||||
.setDescription(`${supportbot.UserNotFound}\n\nTry Again:\`${supportbot.Prefix}${supportbot.RemoveUser} <user#0000>\``)
|
||||
.setColor(supportbot.ErrorColour)
|
||||
|
||||
if (!rUser) return message.channel.send({ embed: UserNotExist });
|
||||
|
||||
message.channel.updateOverwrite(rUser, {
|
||||
VIEW_CHANNEL: false,
|
||||
CREATE_INVITE: false,
|
||||
SEND_MESSAGES: false,
|
||||
READ_MESSAGES: false
|
||||
});
|
||||
|
||||
const Complete = new Discord.MessageEmbed()
|
||||
.setTitle("User Removed!")
|
||||
.setDescription(supportbot.RemovedUser.replace(/%user%/g, rUser.id))
|
||||
.setTimestamp()
|
||||
.setColor(supportbot.EmbedColour)
|
||||
message.channel.send({ embed: Complete });
|
||||
} else {
|
||||
return message.channel.send({ embed: NoPerms });
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
@@ -1,70 +0,0 @@
|
||||
// SupportBot, Created by Emerald Services
|
||||
// Suggest Command
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = {
|
||||
name: supportbot.SuggestCommand,
|
||||
description: supportbot.SuggestionDesc,
|
||||
|
||||
execute(message, args) {
|
||||
if (supportbot.DeleteMessages) message.delete();
|
||||
|
||||
let locateChannel = message.guild.channels.cache.find(SuggestionChannel => SuggestionChannel.name === supportbot.SuggestionChannel) || message.guild.channels.cache.find(SuggestionChannel => SuggestionChannel.id === supportbot.SuggestionChannel)
|
||||
|
||||
const errornochannel = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Channel")
|
||||
.setDescription(`${supportbot.InvalidChannel}\n\nChannel Required: \`${supportbot.SuggestionChannel}\``)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
|
||||
if(!locateChannel) return message.channel.send({ embed: errornochannel });
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setDescription(`> **${supportbot.SuggestionStarter}**`)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
message.channel.send({ embed: embed });
|
||||
|
||||
let suggestion = []
|
||||
message.channel.awaitMessages(response => response.content.length > 2, {
|
||||
max: 1,
|
||||
time: 500000,
|
||||
errors: ['time'],
|
||||
}).then((collected) => {
|
||||
suggestion.push(collected.map(r => r.content));
|
||||
|
||||
const SuggestionMessage = new Discord.MessageEmbed()
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter(supportbot.EmbedFooter)
|
||||
|
||||
.addField(supportbot.SuggestionTitle, suggestion, true)
|
||||
.addField("From", `<@${message.author.id}>`, true)
|
||||
|
||||
if (supportbot.SuggestionMessage_Icon === "BOT") {
|
||||
SuggestionMessage.setThumbnail(bot.user.displayAvatarURL())
|
||||
}
|
||||
|
||||
if (supportbot.SuggestionMessage_Icon === "USER") {
|
||||
SuggestionMessage.setThumbnail(message.author.displayAvatarURL())
|
||||
}
|
||||
|
||||
if (supportbot.SuggestionMessage_Icon === "CUSTOM") {
|
||||
SuggestionMessage.setThumbnail(supportbot.SuggestionIcon_URL)
|
||||
}
|
||||
|
||||
locateChannel.send({ embed: SuggestionMessage }).then(async function(msg) {
|
||||
msg.react(supportbot.SuggestReact_1).then(() => msg.react(supportbot.SuggestReact_2));
|
||||
});
|
||||
|
||||
const SuggestionComplete = new Discord.MessageEmbed()
|
||||
.setColor(supportbot.SuccessColour)
|
||||
.setDescription(`:white_check_mark: Your suggestion has been successfully created. <#${locateChannel.id}>`)
|
||||
message.channel.send({ embed: SuggestionComplete })
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
@@ -1,230 +0,0 @@
|
||||
// SupportBot, Created by Emerald Services
|
||||
// Ticket Command
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const bot = new Discord.Client()
|
||||
|
||||
const fs = require("fs")
|
||||
const yaml = require('js-yaml');
|
||||
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
const TicketNumberID = require('../utils/TicketNumber.js');
|
||||
|
||||
module.exports = {
|
||||
name: supportbot.NewTicket,
|
||||
description: supportbot.NewTicketDesc,
|
||||
|
||||
async execute(message, args) {
|
||||
if (!message.channel.name === supportbot.ReactionChannel || !message.channel.id === supportbot.ReactionChannel) {
|
||||
if (supportbot.DeleteMessages) message.delete();
|
||||
}
|
||||
|
||||
let reactionUser = message.guild.members.cache.get(message.author.id)
|
||||
|
||||
if (reactionUser.roles.cache.find(role => role.name === supportbot.TicketBlackListRole) || reactionUser.roles.cache.find(role => role.id === supportbot.TicketBlackListRole)) {
|
||||
return message.channel.send(`<@${message.author.id}> ${supportbot.TicketBlackListMessage}`).then(msg => {
|
||||
msg.delete({timeout: 3500})
|
||||
})
|
||||
}
|
||||
|
||||
// Ticket ID
|
||||
let ticketNumberID = TicketNumberID.pad(message.guild.id);
|
||||
|
||||
// Ticket Subject
|
||||
const TicketSubject = args || supportbot.NoTicketSubject;
|
||||
|
||||
const channel = await message.guild.channels.create(`${supportbot.TicketChannel}-${ticketNumberID}`);
|
||||
|
||||
if (message.channel.name === supportbot.ReactionChannel || message.channel.id === supportbot.ReactionChannel) {
|
||||
const CreatedTicket = new Discord.MessageEmbed()
|
||||
.setDescription(supportbot.TicketCreatedAlert.replace(/%ticketauthor%/g, message.author.id).replace(/%ticketid%/g, channel.id).replace(/%ticketusername%/g, message.author.username))
|
||||
.setColor(supportbot.EmbedColour)
|
||||
message.channel.send({embed: CreatedTicket}).then((r) => {
|
||||
r.delete({ timeout:5000 })
|
||||
})
|
||||
} else {
|
||||
const CreatedTicket = new Discord.MessageEmbed()
|
||||
.setDescription(supportbot.TicketCreatedAlert.replace(/%ticketauthor%/g, message.author.id).replace(/%ticketid%/g, channel.id).replace(/%ticketusername%/g, message.author.username))
|
||||
.setColor(supportbot.EmbedColour)
|
||||
message.channel.send({embed: CreatedTicket});
|
||||
}
|
||||
|
||||
// Ticket Category
|
||||
let TicketCategory = message.guild.channels.cache.find(category => category.name === supportbot.TicketCategory) || message.guild.channels.cache.find(category => category.id === supportbot.TicketCategory)
|
||||
|
||||
// Locate Roles
|
||||
let StaffMember = message.guild.roles.cache.find(SupportTeam => SupportTeam.name === supportbot.Staff) || message.guild.roles.cache.find(SupportTeam => SupportTeam.id === supportbot.Staff)
|
||||
let ServerAdmins = message.guild.roles.cache.find(AdminUser => AdminUser.name === supportbot.Admin) || message.guild.roles.cache.find(AdminUser => AdminUser.id === supportbot.Admin)
|
||||
|
||||
if (TicketCategory) {
|
||||
channel.setParent(TicketCategory.id)
|
||||
}
|
||||
|
||||
channel.updateOverwrite(message.guild.id, {
|
||||
SEND_MESSAGES: false,
|
||||
VIEW_CHANNEL: false
|
||||
})
|
||||
|
||||
channel.updateOverwrite(message.author, {
|
||||
SEND_MESSAGES: true,
|
||||
VIEW_CHANNEL: true
|
||||
})
|
||||
|
||||
channel.updateOverwrite(StaffMember, {
|
||||
SEND_MESSAGES: true,
|
||||
VIEW_CHANNEL: true
|
||||
})
|
||||
|
||||
channel.updateOverwrite(ServerAdmins, {
|
||||
SEND_MESSAGES: true,
|
||||
VIEW_CHANNEL: true
|
||||
})
|
||||
|
||||
// Ticket Created, Message Sent
|
||||
|
||||
if (supportbot.AllowTicketMentions) {
|
||||
channel.send(`<@${message.author.id}>`)
|
||||
}
|
||||
|
||||
const TicketMessage = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.Ticket_Title.replace(/%ticketauthor%/g, message.author.id).replace(/%ticketid%/g, channel.id).replace(/%ticketusername%/g, message.author.username))
|
||||
.setDescription(supportbot.TicketMessage.replace(/%ticketauthor%/g, message.author.id).replace(/%ticketid%/g, channel.id).replace(/%ticketusername%/g, message.author.username))
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
if (supportbot.TicketSubject === "embed") {
|
||||
|
||||
if (TicketSubject != 'No Reason Provided.') {
|
||||
TicketMessage.addFields({ name: 'Reason', value: TicketSubject })
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (supportbot.TicketSubject === "description") {
|
||||
|
||||
if (TicketSubject != 'No Reason Provided.') {
|
||||
channel.setTopic(`Reason: ${TicketSubject} - User ID: ${message.author.id} - Ticket: ${channel.name}`)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const reactionMessage = await channel.send({
|
||||
embed: TicketMessage
|
||||
}).then( async function(ticketmsg) {
|
||||
await ticketmsg.react(supportbot.TicketLockReaction)
|
||||
await ticketmsg.react(supportbot.TicketDeleteReaction)
|
||||
|
||||
const collector = ticketmsg.createReactionCollector(
|
||||
(reaction, user) => message.guild.roles.cache.find((staff) => staff.name === supportbot.Staff),
|
||||
{ dispose: true }
|
||||
);
|
||||
|
||||
collector.on('collect', (reaction, user) => {
|
||||
switch (reaction.emoji.name) {
|
||||
case supportbot.TicketLockReaction:
|
||||
|
||||
channel.updateOverwrite(message.author, {
|
||||
SEND_MESSAGES: false,
|
||||
VIEW_CHANNEL: true
|
||||
});
|
||||
|
||||
const LockTicketEmbed = new Discord.MessageEmbed()
|
||||
.setDescription(supportbot.TicketLockMessage)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
channel.send({embed: LockTicketEmbed})
|
||||
break;
|
||||
|
||||
case supportbot.TicketDeleteReaction:
|
||||
const DeleteTicketEmbed = new Discord.MessageEmbed()
|
||||
.setDescription(supportbot.TicketDeleteMessage)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
channel.send({embed: DeleteTicketEmbed})
|
||||
|
||||
let logChannel = message.guild.channels.cache.find(channel => channel.name === supportbot.TranscriptLog) || message.guild.channels.cache.find(channel => channel.id === supportbot.TranscriptLog)
|
||||
let user = message.author;
|
||||
let reason = args.join(" ") || "No Reason Provided.";
|
||||
|
||||
let name = message.channel.name;
|
||||
let ticketChannel = message.channel;
|
||||
|
||||
message.channel.send(`**${supportbot.ClosingTicket}**`)
|
||||
|
||||
.then(() => {
|
||||
const logEmbed = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.TranscriptTitle)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter(supportbot.EmbedFooter)
|
||||
.addField("Closed By", message.author.tag)
|
||||
.addField("Reason", reason);
|
||||
|
||||
message.channel.messages.fetch({ limit: 100 }).then( msgs => {
|
||||
let html = '';
|
||||
|
||||
msgs = msgs.sort( ( a, b ) => a.createdTimestamp - b.createdTimestamp );
|
||||
html += `<strong>Server Name:</strong> ${message.guild.name}<br>`;
|
||||
html += `<strong>Ticket:</strong> ${ticketChannel.name}<br>`;
|
||||
html += `<strong>Message:</strong> ${msgs.size} Messages<br><br><br>`;
|
||||
|
||||
msgs.forEach( msg => {
|
||||
if ( msg.content ) {
|
||||
html += `<strong>User:</strong> ${msg.author.tag}<br>`;
|
||||
html += `<strong>Message:</strong> ${msg.content}<br>`;
|
||||
html += `-----<br><br>`;
|
||||
}
|
||||
});
|
||||
|
||||
logChannel.send(logEmbed).catch(err => {
|
||||
message.reply(err)
|
||||
})
|
||||
|
||||
const TranscriptSavedEmbed = new Discord.MessageEmbed()
|
||||
.setDescription(supportbot.TranscriptSavedMessage)
|
||||
.setColor(supportbot.SuccessColour)
|
||||
channel.send({embed: TranscriptSavedEmbed})
|
||||
|
||||
logChannel.send( new Discord.MessageAttachment( Buffer.from( html ), `${name}.html` ) );
|
||||
setTimeout(() => channel.delete(), supportbot.TicketDeleteTime);
|
||||
|
||||
})
|
||||
|
||||
}).catch( () => {
|
||||
m.edit('The request to close the ticket has timed out.').then( m2 => m2.delete( 3000 ) );
|
||||
});
|
||||
break;
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
fs.writeFileSync("./storage/SupportTickets.json", '{\n "ticket": "' + channel.name + '", \n "id":' + message.author.id + "\n}", (err) => {
|
||||
if (!err) return;
|
||||
console.error(err)
|
||||
})
|
||||
// Ticket Logs
|
||||
|
||||
const errornochannel = new Discord.MessageEmbed()
|
||||
.setTitle("SupportBot Error!")
|
||||
.setDescription(`:x: **Error!** Channel not Found, This command cannot be executed proberbly as their is no channel within this server.\nThis is configurable via **supportbot-config.yml**\n\nChannel Required: \`${supportbot.TicketLog}\`\n\nError Code: \`SB-03\``)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
|
||||
const TicketLogs = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.TicketLog_Title)
|
||||
.setThumbnail(supportbot.Ticket_Thumbnail)
|
||||
.addFields(
|
||||
{ name: 'Ticket', value: `<#${channel.id}>` },
|
||||
{ name: 'User', value: `<@${message.author.id}>` },
|
||||
)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter(supportbot.EmbedFooter)
|
||||
|
||||
let locateChannel = message.guild.channels.cache.find(LocateChannel => LocateChannel.name === supportbot.TicketLog) || message.guild.channels.cache.find(LocateChannel => LocateChannel.id === supportbot.TicketLog)
|
||||
|
||||
if(!locateChannel) return message.channel.send({ embed: errornochannel });
|
||||
|
||||
locateChannel.send({ embed: TicketLogs });
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
// SupportBot, Created by Emerald Services
|
||||
// Announce
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const { execute } = require("./help");
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = {
|
||||
name: supportbot.ChatLog,
|
||||
description: supportbot.ChatLogDesc,
|
||||
|
||||
execute(message, args) {
|
||||
if (supportbot.DeleteMessages) message.delete();
|
||||
|
||||
let name = message.channel.name;
|
||||
|
||||
message.channel.messages.fetch({ limit: 100 }).then( msgs => {
|
||||
let html = '';
|
||||
|
||||
msgs = msgs.sort( ( a, b ) => a.createdTimestamp - b.createdTimestamp );
|
||||
html += `<strong>--- Channel Transcript ---</strong><br>`;
|
||||
html += `<strong>Server Name:</strong> ${message.guild.name}<br>`;
|
||||
html += `<strong>Channel:</strong> ${name}<br>`;
|
||||
html += `<strong>Message:</strong> ${msgs.size} Messages<br><br><br>`;
|
||||
|
||||
msgs.forEach( msg => {
|
||||
if ( msg.content ) {
|
||||
html += `<strong>User:</strong> ${msg.author.tag}<br>`;
|
||||
html += `<strong>Message:</strong> ${msg.content}<br>`;
|
||||
html += `-----<br><br>`;
|
||||
}
|
||||
});
|
||||
|
||||
const TranscriptSavedEmbed = new Discord.MessageEmbed()
|
||||
.setDescription(supportbot.ChatLogSavedMessage)
|
||||
.setColor(supportbot.SuccessColour)
|
||||
message.channel.send({embed: TranscriptSavedEmbed})
|
||||
|
||||
const errornochannel = new Discord.MessageEmbed()
|
||||
.setTitle("SupportBot Error!")
|
||||
.setDescription(`:x: **Error!** Channel not Found, This command cannot be executed proberbly as their is no channel within this server.\nThis is configurable via **supportbot-config.yml**\n\nChannel Required: \`${supportbot.TicketLog}\`\n\nError Code: \`SB-03\``)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
|
||||
const ChatLogs = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.ChatLog_Title)
|
||||
.setThumbnail(supportbot.ChatLog_Thumbnail)
|
||||
.addFields(
|
||||
{ name: 'Channel', value: `<#${message.channel.id}>` },
|
||||
{ name: 'User', value: `<@${message.author.id}>` },
|
||||
)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter(supportbot.EmbedFooter)
|
||||
|
||||
let locateChannel = message.guild.channels.cache.find(LocateChannel => LocateChannel.name === supportbot.ChatLogChannel) || message.guild.channels.cache.find(LocateChannel => LocateChannel.id === supportbot.ChatLogChannel)
|
||||
|
||||
if(!locateChannel) return message.channel.send({ embed: errornochannel });
|
||||
|
||||
locateChannel.send( new Discord.MessageAttachment( Buffer.from( html ), `${name}.html` ) );
|
||||
locateChannel.send({ embed: ChatLogs });
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
// SupportBot 6.0, Created by Emerald Services
|
||||
// Ready Event
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = async (bot, member) => {
|
||||
|
||||
if (supportbot.SystemMessages) {
|
||||
const SystemChannel = member.guild.channels.cache.find(channel => channel.name === supportbot.SystemMessage_Channel) || member.guild.channels.cache.get(supportbot.SystemMessage_Channel)
|
||||
|
||||
if (!SystemChannel) return;
|
||||
|
||||
console.log(`[${supportbot.Bot_Name}]: ${member.user.username} has joined ${member.guild.name}!`)
|
||||
console.log(supportbot.AutoRole_Role)
|
||||
|
||||
const role = member.guild.roles.cache.find(role => role.name === supportbot.AutoRole_Role) || member.guild.roles.cache.find(role => role.id === supportbot.AutoRole_Role)
|
||||
|
||||
member.roles.add(role).catch(console.error);
|
||||
|
||||
if (supportbot.SystemMessage_Type === "embed") {
|
||||
|
||||
const GuildAddMember = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.Welcome_Title)
|
||||
.setDescription(supportbot.WelcomeMessage.replace(/%member%/g, `<@!${member.user.id}>`).replace(/%guildname%/g, member.guild.name))
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
if (supportbot.SystemMessage_Icon === "BOT") {
|
||||
GuildAddMember.setThumbnail(bot.user.displayAvatarURL())
|
||||
}
|
||||
|
||||
if (supportbot.SystemMessage_Icon === "USER") {
|
||||
GuildAddMember.setThumbnail(member.user.displayAvatarURL())
|
||||
}
|
||||
|
||||
if (supportbot.SystemMessage_Icon === "CUSTOM") {
|
||||
SuggestionMessage.setThumbnail(supportbot.SystemMessageIcon_URL)
|
||||
}
|
||||
|
||||
|
||||
if (supportbot.SystemMessage_EmbedFooter) {
|
||||
GuildAddMember.setFooter(supportbot.EmbedFooter)
|
||||
}
|
||||
|
||||
SystemChannel.send({ embed: GuildAddMember });
|
||||
|
||||
}
|
||||
|
||||
if (supportbot.SystemMessage_Type === "normal") {
|
||||
SystemChannel.send(supportbot.WelcomeMessage.replace(/%member%/g, member.user.username).replace(/%guildname%/g, member.guild.name))
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
@@ -1,48 +0,0 @@
|
||||
// SupportBot 6.0, Created by Emerald Services
|
||||
// Ready Event
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = async (bot, member) => {
|
||||
|
||||
if (supportbot.SystemMessages) {
|
||||
const SystemChannel = member.guild.channels.cache.find(channel => channel.name === supportbot.SystemMessage_Channel) || member.guild.channels.cache.get(supportbot.SystemMessage_Channel)
|
||||
|
||||
if (!SystemChannel) return;
|
||||
|
||||
console.log(`[${supportbot.Bot_Name}]: ${member.user.username} has left ${member.guild.name}!`)
|
||||
|
||||
if (supportbot.SystemMessage_Type === "embed") {
|
||||
const GuildRemoveMember = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.Leave_Title)
|
||||
.setDescription(supportbot.LeaveMessage.replace(/%member%/g, member.user.username).replace(/%guildname%/g, member.guild.name))
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
if (supportbot.SystemMessage_Icon === "BOT") {
|
||||
GuildRemoveMember.setThumbnail(bot.user.displayAvatarURL())
|
||||
}
|
||||
|
||||
if (supportbot.SystemMessage_Icon === "USER") {
|
||||
GuildRemoveMember.setThumbnail(member.user.displayAvatarURL())
|
||||
}
|
||||
|
||||
|
||||
if (supportbot.SystemMessage_EmbedFooter === "true") {
|
||||
GuildRemoveMember.setFooter(supportbot.EmbedFooter)
|
||||
}
|
||||
|
||||
SystemChannel.send({ embed: GuildRemoveMember });
|
||||
|
||||
}
|
||||
|
||||
if (supportbot.SystemMessage_Type === "normal") {
|
||||
SystemChannel.send(supportbot.LeaveMessage.replace(/%member%/g, member.user.username).replace(/%guildname%/g, member.guild.name))
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
@@ -1,24 +0,0 @@
|
||||
// SupportBot 6.0, Created by Emerald Services
|
||||
// Message Event
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = async (bot, message) => {
|
||||
if(message.author.bot) return;
|
||||
if(message.channel.type === "dm") return;
|
||||
if (message.content.indexOf(supportbot.Prefix) !== 0) return;
|
||||
|
||||
let messageArray = message.content.split(" ");
|
||||
const args = message.content.slice(supportbot.Prefix.length).trim().split(/ +/g);
|
||||
const command = args.shift().toLowerCase();
|
||||
|
||||
console.log(`\u001b[32m`, `[${supportbot.Bot_Name}]`, `\u001b[36m`, `${message.author.tag}`, `\u001b[33m`, `has executed the command`, `\u001b[36m`,`${supportbot.Prefix}${command}`)
|
||||
|
||||
const cmd = bot.commands.get(command);
|
||||
if(!cmd) return;
|
||||
cmd.execute(message, args);
|
||||
};
|
||||
@@ -1,36 +0,0 @@
|
||||
// SupportBot 6.0, Created by Emerald Services
|
||||
// Message Reaction Event
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
const tickets = yaml.load(fs.readFileSync('./storage/ticketreaction.yml', 'utf8'));
|
||||
|
||||
module.exports = async (client, reaction, user) => {
|
||||
|
||||
let message = {
|
||||
guild: reaction.message.channel.guild,
|
||||
author: user,
|
||||
content: "N/A",
|
||||
channel: reaction.message.channel
|
||||
}
|
||||
|
||||
if (supportbot.ReactionTickets) {
|
||||
if (reaction.message.id === tickets.ReactionMessage_ID) {
|
||||
if (reaction.emoji.name == supportbot.ReactionEmoji || reaction.emoji.id == supportbot.ReactionEmoji) {
|
||||
await reaction.users.remove(user.id)
|
||||
|
||||
try {
|
||||
const cmd = client.commands.get(supportbot.NewTicket);
|
||||
if(!cmd) return;
|
||||
|
||||
cmd.execute(message, message.content);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,26 +0,0 @@
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
|
||||
|
||||
module.exports = async (bot, message, packet) => {
|
||||
if (!['MESSAGE_REACTION_ADD', 'MESSAGE_REACTION_REMOVE'].includes(packet.t)) return;
|
||||
|
||||
const channel = bot.channels.cache.get(packet.d.channel_id);
|
||||
if (channel.messages.has(packet.d.message_id)) return;
|
||||
|
||||
channel.messages.fetch(packet.d.message_id).then(message => {
|
||||
const emoji = packet.d.emoji.id ? `${packet.d.emoji.name}:${packet.d.emoji.id}` : packet.d.emoji.name;
|
||||
const reaction = message.reactions.get(emoji);
|
||||
if (reaction) reaction.users.set(packet.d.user_id, bot.users.get(packet.d.user_id));
|
||||
if (packet.t === 'MESSAGE_REACTION_ADD') {
|
||||
bot.emit('messageReactionAdd', reaction, bot.users.get(packet.d.user_id));
|
||||
}
|
||||
if (packet.t === 'MESSAGE_REACTION_REMOVE') {
|
||||
bot.emit('messageReactionRemove', reaction, bot.users.get(packet.d.user_id));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
// SupportBot 6.0, Created by Emerald Services
|
||||
// Ready Event
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
const tickets = yaml.load(fs.readFileSync('./storage/ticketreaction.yml', 'utf8'));
|
||||
|
||||
|
||||
module.exports = async (bot) => {
|
||||
bot.user.setActivity(supportbot.BotActivity, {
|
||||
type: supportbot.ActivityType,
|
||||
url: supportbot.StreamingURL
|
||||
|
||||
});
|
||||
|
||||
console.log(`\u001b[32m`, `┏━━━┓╋╋╋╋╋╋╋╋╋╋╋╋╋┏┓┏━━┓╋╋╋┏┓`)
|
||||
console.log(`\u001b[32m`, `┃┏━┓┃╋╋╋╋╋╋╋╋╋╋╋╋┏┛┗┫┏┓┃╋╋┏┛┗┓`)
|
||||
console.log(`\u001b[32m`, `┃┗━━┳┓┏┳━━┳━━┳━━┳┻┓┏┫┗┛┗┳━┻┓┏┛`)
|
||||
console.log(`\u001b[32m`, `┗━━┓┃┃┃┃┏┓┃┏┓┃┏┓┃┏┫┃┃┏━┓┃┏┓┃┃`)
|
||||
console.log(`\u001b[32m`, `┃┗━┛┃┗┛┃┗┛┃┗┛┃┗┛┃┃┃┗┫┗━┛┃┗┛┃┗┓`)
|
||||
console.log(`\u001b[32m`, `┗━━━┻━━┫┏━┫┏━┻━━┻┛┗━┻━━━┻━━┻━┛`)
|
||||
console.log(`\u001b[32m`, `┗╋╋╋╋╋╋╋┃┃╋┃┃`)
|
||||
console.log(`\u001b[32m`, `╋╋╋╋╋╋╋┗┛╋┗┛`)
|
||||
console.log(` `)
|
||||
console.log(`\u001b[31m`, `――――――――――――――――――――――――――――――――――――――――――――`)
|
||||
console.log(` `)
|
||||
console.log(`\u001b[33m`, `${supportbot.Bot_Name} v${supportbot.SupportBot_Version}`, `\u001b[36m`, `Connected to Discord`)
|
||||
console.log(`\u001b[33m`, `Documentation:`, `\u001b[36m`, `https://docs.emeraldsrv.dev`)
|
||||
console.log(`\u001b[33m`, `Discord:`, `\u001b[36m`, `https://emeraldsrv.dev/discord`)
|
||||
console.log(`\u001b[33m`, `Hosting:`, `\u001b[36m`, `https://emeraldsrv.dev/hosting`)
|
||||
console.log(` `)
|
||||
console.log(`\u001b[37m`, `SupportBot proudly created by Emerald Services`)
|
||||
console.log(` `)
|
||||
console.log(`\u001b[31m`, `――――――――――――――――――――――――――――――――――――――――――――`)
|
||||
|
||||
|
||||
|
||||
if (supportbot.ReactionTickets === true) {
|
||||
let chan1 = bot.channels.cache.find(channel => channel.name === supportbot.ReactionChannel)
|
||||
|
||||
if (!chan1) {
|
||||
console.log('\u001b[33m', "[WARN] Ticket reaction panel is not setup, You can do so via the configuration file!")
|
||||
return false;
|
||||
}
|
||||
|
||||
chan1.messages.fetch(tickets.ReactionMessage_ID).catch(r => {
|
||||
let embed = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.ReactionMessage.replace(/%reaction_emoji%/g, supportbot.ReactionEmoji))
|
||||
.setColor(supportbot.SuccessColour)
|
||||
.setFooter(supportbot.EmbedFooter);
|
||||
|
||||
if (supportbot.ReactionPanel_Description === true) {
|
||||
embed.setDescription(supportbot.ReactionDescription)
|
||||
}
|
||||
|
||||
if (supportbot.ReactionPanel_Thumbnail === true) {
|
||||
embed.setThumbnail(supportbot.ReactionThumbnail)
|
||||
}
|
||||
|
||||
if (supportbot.ReactionPanel_Image === true) {
|
||||
embed.setImage(supportbot.ReactionImage)
|
||||
}
|
||||
|
||||
bot.channels.cache.find(channel => channel.name === supportbot.ReactionChannel).send({
|
||||
embed: embed
|
||||
}).then(r => {
|
||||
let data = {
|
||||
"ReactionMessage_ID": `${r.id}`
|
||||
}
|
||||
let yamlStr = yaml.dump(data);
|
||||
fs.writeFileSync('./storage/ticketreaction.yml', yamlStr, 'utf8');
|
||||
|
||||
r.react(supportbot.ReactionEmoji);
|
||||
}).catch(e => {
|
||||
console.log(e)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
@@ -1,105 +1,23 @@
|
||||
// ___ _ ___ _
|
||||
// / __> _ _ ___ ___ ___ _ _ _| |_ | . > ___ _| |_
|
||||
// \__ \| | || . \| . \/ . \| '_> | | | . \/ . \ | |
|
||||
// <___/`___|| _/| _/\___/|_| |_| |___/\___/ |_|
|
||||
// |_| |_|
|
||||
// ___ _ ___ _
|
||||
// / __> _ _ ___ ___ ___ _ _ _| |_ | . > ___ _| |_
|
||||
// \__ \| | || . \| . \/ . \| '_> | | | . \/ . \ | |
|
||||
// <___/`___|| _/| _/\___/|_| |_| |___/\___/ |_|
|
||||
// |_| |_|
|
||||
//
|
||||
// SupportBot created by Emerald Services
|
||||
// Installed with MIT License
|
||||
//
|
||||
// Discord Support: https://emeraldsrv.dev/discord
|
||||
// Community Resources: https://emeraldsrv.dev/resources
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
const bot = new Discord.Client();
|
||||
|
||||
bot.commands = new Discord.Collection();
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(
|
||||
fs.readFileSync("./Configs/supportbot.yml", "utf8")
|
||||
);
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
const Client = require("./Structures/Client.js");
|
||||
const client = new Client({});
|
||||
|
||||
const { promisify } = require("util");
|
||||
const readdir = promisify(require("fs").readdir);
|
||||
|
||||
String.prototype.toProperCase = function () {
|
||||
return this.replace(
|
||||
/([^\W_]+[^\s-]*) */g,
|
||||
(txt) => txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase()
|
||||
);
|
||||
};
|
||||
|
||||
const init = async () => {
|
||||
const evtFiles = await readdir("./events/");
|
||||
|
||||
console.info(`\u001b[36m`, `➢ SupportBot Events`);
|
||||
console.info(` `);
|
||||
|
||||
evtFiles.forEach((file, i) => {
|
||||
const eventName = file.split(".")[0];
|
||||
const event = require(`./events/${file}`);
|
||||
console.info(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[36m`, `#${i + 1} Event Loaded: ${eventName.toProperCase()} `);
|
||||
|
||||
bot.on(eventName, event.bind(null, bot));
|
||||
delete require.cache[require.resolve(`./events/${file}`)];
|
||||
});
|
||||
|
||||
console.info(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[36m`, `Successfully loaded ${evtFiles.length} events.`);
|
||||
console.log(`\u001b[31m`, `――――――――――――――――――――――――――――――――――――――――――――`)
|
||||
console.log(` `)
|
||||
};
|
||||
|
||||
init();
|
||||
|
||||
fs.readdir("./commands/", (err, files) => {
|
||||
|
||||
console.info(`\u001b[36m`, `➢ SupportBot Commands`);
|
||||
console.info(` `);
|
||||
|
||||
if (err) console.info(err, "error");
|
||||
|
||||
let jsfiles = files.filter((f) => f.split(".").pop() === "js");
|
||||
|
||||
if (jsfiles.length <= 0) {
|
||||
console.log(`[${supportbot.Bot_Name}]: No commands found. Try to Re-download the resource`);
|
||||
return;
|
||||
}
|
||||
|
||||
jsfiles.forEach((f, i) => {
|
||||
let props = require(`./commands/${f}`);
|
||||
|
||||
console.info(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[36m`, `#${i + 1} Command Loaded: ${props.name.toProperCase()}`);
|
||||
bot.commands.set(props.name, props);
|
||||
});
|
||||
|
||||
console.info(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[36m`, `Loaded ${jsfiles.length} commands!`);
|
||||
console.log(`\u001b[31m`, `――――――――――――――――――――――――――――――――――――――――――――`)
|
||||
console.log(` `)
|
||||
});
|
||||
|
||||
fs.readdir("./addons/", (err, files) => {
|
||||
|
||||
console.info(`\u001b[36m`, `➢ SupportBot Addons`);
|
||||
console.info(` `);
|
||||
|
||||
if (err) console.info(err, "error");
|
||||
|
||||
let jsfiles = files.filter((f) => f.split(".").pop() === "js");
|
||||
|
||||
if (jsfiles.length <= 0) {
|
||||
console.log(`[${supportbot.Bot_Name}]: No addons found. You can download addons from https://emeraldsrv.dev`);
|
||||
return;
|
||||
}
|
||||
|
||||
jsfiles.forEach((f, i) => {
|
||||
let props = require(`./addons/${f}`);
|
||||
|
||||
console.info(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[36m`, `#${i + 1} Addon Loaded: ${props.name.toProperCase()}`);
|
||||
bot.commands.set(props.name, props);
|
||||
});
|
||||
|
||||
console.info(`\u001b[32m`, `[${supportbot.Bot_Name}]:`, `\u001b[36m`, `Loaded ${jsfiles.length} addons!`);
|
||||
console.log(`\u001b[31m`, `――――――――――――――――――――――――――――――――――――――――――――`)
|
||||
console.log(` `)
|
||||
});
|
||||
|
||||
bot.login(supportbot.Token);
|
||||
client.start(supportbot.Token);
|
||||
@@ -1,8 +0,0 @@
|
||||
SupportBot Language Compatibility
|
||||
|
||||
In order to switch languages simple remove the current existig configuration file and replace it with one of the files here renamnig the file to "supportbot-config.yml" from (for example) "supportbot-config_es.yml" to home directory of SupportBot.
|
||||
|
||||
-> Delete the existing supportbot-config.yml file
|
||||
-> Download the new file for whatever language
|
||||
-> Upload the file to SupportBot and rename it to supportbot-config.yml
|
||||
-> Job Done, restart the bot :wink:
|
||||
@@ -1,310 +0,0 @@
|
||||
# ___ _ ___ _
|
||||
# / __> _ _ ___ ___ ___ _ _ _| |_ | . > ___ _| |_
|
||||
# \__ \| | || . \| . \/ . \| '_> | | | . \/ . \ | |
|
||||
# <___/`___|| _/| _/\___/|_| |_| |___/\___/ |_|
|
||||
# |_| |_|
|
||||
#
|
||||
# SupportBot created by Emerald Services
|
||||
# Installed with MIT License
|
||||
#
|
||||
# Discord Support: https://emeraldsrv.dev/discord
|
||||
|
||||
SupportBot_Version: "7.1 pre-1"
|
||||
|
||||
# -------------------------
|
||||
# General Configuration
|
||||
# -------------------------
|
||||
|
||||
Token: "BOT_TOKEN_HERE"
|
||||
Prefix: "!!"
|
||||
Bot_Name: "SupportBot"
|
||||
|
||||
DeleteMessages: true
|
||||
# Should the bot delete command messages after executed?
|
||||
|
||||
# -------------------------
|
||||
# Activity Configuration
|
||||
# -------------------------
|
||||
|
||||
BotActivity: "-help | SupportBot"
|
||||
|
||||
StreamingURL: "https://www.twitch.tv/YOUR_TWITCH_NAME"
|
||||
# Set The ActivityType to "STREAMING" for a streaming status!
|
||||
|
||||
ActivityType: "PLAYING"
|
||||
# Activity status can either be PLAYING, WATCHING, LISTENING or STREAMING.
|
||||
|
||||
# -------------------------
|
||||
# Embed Configuration
|
||||
# -------------------------
|
||||
|
||||
EmbedColour: "#f74343"
|
||||
EmbedFooter: "SupportBot | The #1 Supportive Discord Bot"
|
||||
|
||||
ErrorColour: "#d12519"
|
||||
SuccessColour: "#04b545"
|
||||
WarningColour: "#fca117"
|
||||
|
||||
# -------------------------
|
||||
# Help Configuration
|
||||
# -------------------------
|
||||
|
||||
HelpMenu: true # Do not change!
|
||||
SendHelpPage: "channel" # Set to channel or dm
|
||||
|
||||
# -------------------------
|
||||
# Role Configuration
|
||||
# -------------------------
|
||||
|
||||
AutoRole: true
|
||||
AutoRole_Role: "Member"
|
||||
LockdownRole: "@everyone"
|
||||
|
||||
Staff: "Staff"
|
||||
Admin: "Admin"
|
||||
TicketBlackListRole: "Blacklisted"
|
||||
|
||||
# -------------------------
|
||||
# Tickets Configuration
|
||||
# -------------------------
|
||||
|
||||
# --- General Config ---
|
||||
# --- Start ---
|
||||
|
||||
TicketCategory: "▬▬ TICKETS ▬▬"
|
||||
TicketChannel: "ticket"
|
||||
|
||||
TicketLog: "ticket-logs"
|
||||
TranscriptLog: "transcripts"
|
||||
|
||||
TranscriptTitle: "Ticket Transcript"
|
||||
TicketBlackListMessage: "You are not allowed to open a ticket"
|
||||
|
||||
TicketSubject: "description"
|
||||
# "description" will displays the ticket reason within the channel description
|
||||
# "embed" will displays the ticket reason within the ticket embed
|
||||
|
||||
AllowTicketMentions: true
|
||||
# Set to true to allow the ticket to mention the author and the support team.
|
||||
# Set to false to dis-allow mentions within tickets.
|
||||
|
||||
# --- Panel Config ---
|
||||
# --- Start ---
|
||||
|
||||
ReactionChannel: "create-ticket"
|
||||
ReactionEmoji: "📩"
|
||||
# For cusomt emojis: <:emoji_name:EMOJI_ID>
|
||||
|
||||
ReactionTickets: true
|
||||
ReactionMessage: "React with %reaction_emoji% to create a Support Ticket!"
|
||||
|
||||
ReactionPanel_Description: true
|
||||
ReactionDescription: "Create a support ticket to contact a member of staff."
|
||||
|
||||
ReactionPanel_Thumbnail: true
|
||||
ReactionThumbnail: "https://hotemoji.com/images/dl/5/ticket-emoji-by-twitter.png"
|
||||
|
||||
ReactionPanel_Image: true
|
||||
ReactionImage: "https://wallpapercave.com/wp/wp4462546.jpg"
|
||||
|
||||
# --- Creation Config ---
|
||||
# --- Start ---
|
||||
|
||||
# Available Placeholders:
|
||||
|
||||
# %ticketusername% - User who created the ticket.
|
||||
# <@%ticketauthor%> - Tags the user who created the ticket.
|
||||
# <#%ticketid%> - Mentions the ticket channel.
|
||||
|
||||
|
||||
Ticket_Title: "Server Support | %ticketusername%"
|
||||
TicketMessage: "Hello <@%ticketauthor%>, Thank you for creating a support ticket\nPlease wait patiently whilst a member of our team reaches out to you."
|
||||
|
||||
Ticket_Thumbnail: "https://images.emojiterra.com/google/android-pie/512px/1f39f.png"
|
||||
NoTicketSubject: "No Reason Provided!"
|
||||
|
||||
TicketCreatedAlert: ":ticket: Your support ticket has been created: <#%ticketid%>"
|
||||
|
||||
AddedUser: "👍 <@%user%> has been added to this ticket"
|
||||
RemovedUser: "👍 <@%user%> has been removed from this ticket"
|
||||
|
||||
|
||||
TicketLockReaction: "🔒"
|
||||
TicketDeleteReaction: "⛔"
|
||||
|
||||
TranscriptSavedMessage: "📝 **Transcript Saved!**"
|
||||
TicketLockMessage: "❌ **Ticket Locked!**"
|
||||
TicketDeleteMessage: "⚠ **Ticket Deleting!**" # Tickets deleting after 5 seconds by default.
|
||||
TicketDeleteTime: 5000 # Time must be set in miliseconds.
|
||||
|
||||
# --- Closing Config ---
|
||||
# --- Start ---
|
||||
|
||||
ClosingTicket: ":warning: You have requested to close your support ticket."
|
||||
ClosingConfirmation_Word: "confirm"
|
||||
CloseConfirmation: true
|
||||
|
||||
# --- Departments Config ---
|
||||
# --- Start ---
|
||||
|
||||
TicketDepartments: true
|
||||
|
||||
AllowStaff: true
|
||||
# If set to true users with the "Staff" role will not be able to view tickets
|
||||
# without a valid department role set below.
|
||||
|
||||
# Set to false to allow "Staff" to see tickets whether its a department for them or not.
|
||||
|
||||
DepartmentEmoji_1: "🙋"
|
||||
DepartmentEmoji_2: "💸"
|
||||
DepartmentEmoji_3: "📗"
|
||||
# Ticket emojis, the emojis are what users will need to react with inorder to proceed furthur if departments are enabled.
|
||||
|
||||
DepartmentTitle_1: "Support"
|
||||
DepartmentTitle_2: "Billing"
|
||||
DepartmentTitle_3: "Other"
|
||||
# Ticket department title, This is the title for a ticket department to help users know what is available.
|
||||
|
||||
DepartmentRole_1: "Support"
|
||||
DepartmentRole_2: "Admin"
|
||||
DepartmentRole_3: "Support"
|
||||
# Ticket roles are the roles that will be able to gain access to tickets depending on what department has been choosen.
|
||||
|
||||
# --------------------------------
|
||||
# System Messages Configuration
|
||||
# --------------------------------
|
||||
|
||||
# Available Placeholders:
|
||||
# %guildname% - This displays the name of the discord server.
|
||||
|
||||
SystemMessages: true
|
||||
SystemMessage_EmbedFooter: false
|
||||
|
||||
SystemMessage_Channel: "system-messages"
|
||||
SystemMessage_Type: "embed"
|
||||
# There are 2 types of how you can send system messages, 'normal' or 'embed'
|
||||
|
||||
SystemMessage_Icon: "USER"
|
||||
# USER - This will display the user's icon of who joins.
|
||||
# BOT - This will display the bot's icon when a someone joins.
|
||||
|
||||
Welcome_Title: "User Joined!"
|
||||
WelcomeMessage: "Hello %member%, Welcome to %guildname%!"
|
||||
# %member% define the user who joined and %guildnamne% defines the server name.
|
||||
|
||||
Leave_Title: "User Left!"
|
||||
LeaveMessage: "Goodbye %member%, Thank you for visting %guildname%!"
|
||||
# %member% define the user who left and %guildnamne% defines the server name.
|
||||
|
||||
# -------------------------
|
||||
# Links Configuration
|
||||
# -------------------------
|
||||
|
||||
LinksTitle: "Server Links"
|
||||
|
||||
LINKS:
|
||||
"Website": "https://www.example.com"
|
||||
"Store": "https://store.example.com"
|
||||
"Discord": "https://discord.gg/example"
|
||||
# "Twitter": "https://twitter.com/example"
|
||||
# "Add More": "Just follow this format!"
|
||||
|
||||
# --------------------------
|
||||
# Suggestion Configuration
|
||||
# --------------------------
|
||||
|
||||
SuggestionChannel: "suggestions"
|
||||
SuggestionTitle: "Suggestion"
|
||||
|
||||
SuggestionStarter: "What would you like to suggest?"
|
||||
SuggestReact_1: 👍
|
||||
SuggestReact_2: 👎
|
||||
|
||||
# ----------------------------
|
||||
# Announcement Configuration
|
||||
# ----------------------------
|
||||
|
||||
AnnouncementChannel: "announcements"
|
||||
AnnouncementTitle: "Servername Announcement"
|
||||
AnnouncementIcon: "https://i.imgur.com/HbkZyB7.png"
|
||||
|
||||
AnnouncementStarter: "What would you like to announce?"
|
||||
|
||||
# --------------------------
|
||||
# Moderation Configuration
|
||||
# --------------------------
|
||||
|
||||
BanTitle: "User Banned!"
|
||||
DaysBannedFor: 7
|
||||
BanLogColour: "#D911B4"
|
||||
|
||||
KickTitle: "User Kicked!"
|
||||
KickLogColour: "#D9B111"
|
||||
|
||||
ModThumbnail: "https://i.imgur.com/l6P3DF6.png"
|
||||
ModLogChannel: "mod-logs"
|
||||
|
||||
PruneLogTitle: "Bulk Delete"
|
||||
PruneThumbnail: "https://i.imgur.com/OAgW2vR.png"
|
||||
PruneColour: "#1BA30C"
|
||||
|
||||
BlacklistTitle: "Blacklisted User"
|
||||
BlacklistColour: "#000000"
|
||||
|
||||
# --------------------------
|
||||
# Command Configuration
|
||||
# --------------------------
|
||||
|
||||
# --- User Commands ---
|
||||
|
||||
HelpCommand: "help"
|
||||
LinksCommand: "links"
|
||||
PingCommand: "ping"
|
||||
SuggestCommand: "suggest"
|
||||
|
||||
# --- Ticket Commands ---
|
||||
|
||||
NewTicket: "ticket"
|
||||
CloseTicket: "close"
|
||||
AddUser: "add"
|
||||
RemoveUser: "remove"
|
||||
RenameTicket: "rename"
|
||||
|
||||
# --- Staff/Admin Commands ---
|
||||
|
||||
BotSay: "say"
|
||||
PurgeMessage: "purge"
|
||||
|
||||
AnnounceCommand: "announce"
|
||||
BanUser: "ban"
|
||||
KickUser: "kick"
|
||||
BlacklistUser: "blacklist"
|
||||
|
||||
# --------------------------
|
||||
# Messages Configuration
|
||||
# --------------------------
|
||||
|
||||
# --- Command Messages ---
|
||||
|
||||
NewTicketDesc: "Create a new support ticket"
|
||||
AnnounceDesc: "Create a server announcement"
|
||||
CloseTicketDesc: "Close your support ticket"
|
||||
LinksDesc: "View some important links"
|
||||
PingDesc: "Get the bot's latency"
|
||||
HelpDesc: "Get a list of all the commands"
|
||||
RemoveUserDesc: "Remove a user from a support ticket"
|
||||
AddUserDesc: "Add a user to a support ticket"
|
||||
SuggestionDesc: "Create a server suggestion"
|
||||
BotSayDesc: "Say something with the bot"
|
||||
BanDesc: "Ban a member from this server."
|
||||
KickDesc: "Kick a member from this server."
|
||||
PurgeDesc: "Purge messages from the chat."
|
||||
BlacklistDesc: "Decline a member to open a ticket"
|
||||
|
||||
# Error / Warning Messages
|
||||
|
||||
IncorrectPerms: ":x: **Err!** You do not have the correct permissions to use this command."
|
||||
InvalidChannel: ":x: **Err!** Channel not found. Please create it!"
|
||||
UserNotFound: ":x: **Err!** This user doesn't exist, Are they in this server?"
|
||||
NoValidTicket: ":warning: You cannot execute this command here. This command is used when closing a ticket."
|
||||
TicketExists: ":warning: This ticket cannot be opened, It already exists!"
|
||||
Generated
-120
@@ -1,120 +0,0 @@
|
||||
{
|
||||
"name": "supportbot",
|
||||
"version": "7.0.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@discordjs/collection": {
|
||||
"version": "0.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.1.6.tgz",
|
||||
"integrity": "sha512-utRNxnd9kSS2qhyivo9lMlt5qgAUasH2gb7BEOn6p0efFh24gjGomHzWKMAPn2hEReOPQZCJaRKoURwRotKucQ=="
|
||||
},
|
||||
"@discordjs/form-data": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/form-data/-/form-data-3.0.1.tgz",
|
||||
"integrity": "sha512-ZfFsbgEXW71Rw/6EtBdrP5VxBJy4dthyC0tpQKGKmYFImlmmrykO14Za+BiIVduwjte0jXEBlhSKf0MWbFp9Eg==",
|
||||
"requires": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.8",
|
||||
"mime-types": "^2.1.12"
|
||||
}
|
||||
},
|
||||
"abort-controller": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
|
||||
"integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
|
||||
"requires": {
|
||||
"event-target-shim": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"argparse": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
|
||||
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="
|
||||
},
|
||||
"asynckit": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
|
||||
},
|
||||
"combined-stream": {
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
||||
"requires": {
|
||||
"delayed-stream": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"delayed-stream": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
|
||||
},
|
||||
"discord.js": {
|
||||
"version": "12.5.3",
|
||||
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-12.5.3.tgz",
|
||||
"integrity": "sha512-D3nkOa/pCkNyn6jLZnAiJApw2N9XrIsXUAdThf01i7yrEuqUmDGc7/CexVWwEcgbQR97XQ+mcnqJpmJ/92B4Aw==",
|
||||
"requires": {
|
||||
"@discordjs/collection": "^0.1.6",
|
||||
"@discordjs/form-data": "^3.0.1",
|
||||
"abort-controller": "^3.0.0",
|
||||
"node-fetch": "^2.6.1",
|
||||
"prism-media": "^1.2.9",
|
||||
"setimmediate": "^1.0.5",
|
||||
"tweetnacl": "^1.0.3",
|
||||
"ws": "^7.4.4"
|
||||
}
|
||||
},
|
||||
"event-target-shim": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
|
||||
"integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ=="
|
||||
},
|
||||
"js-yaml": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
|
||||
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
|
||||
"requires": {
|
||||
"argparse": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"mime-db": {
|
||||
"version": "1.48.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.48.0.tgz",
|
||||
"integrity": "sha512-FM3QwxV+TnZYQ2aRqhlKBMHxk10lTbMt3bBkMAp54ddrNeVSfcQYOOKuGuy3Ddrm38I04If834fOUSq1yzslJQ=="
|
||||
},
|
||||
"mime-types": {
|
||||
"version": "2.1.31",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.31.tgz",
|
||||
"integrity": "sha512-XGZnNzm3QvgKxa8dpzyhFTHmpP3l5YNusmne07VUOXxou9CqUqYa/HBy124RqtVh/O2pECas/MOcsDgpilPOPg==",
|
||||
"requires": {
|
||||
"mime-db": "1.48.0"
|
||||
}
|
||||
},
|
||||
"node-fetch": {
|
||||
"version": "2.6.1",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
|
||||
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
|
||||
},
|
||||
"prism-media": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/prism-media/-/prism-media-1.3.1.tgz",
|
||||
"integrity": "sha512-nyYAa3KB4qteJIqdguKmwxTJgy55xxUtkJ3uRnOvO5jO+frci+9zpRXw6QZVcfDeva3S654fU9+26P2OSTzjHw=="
|
||||
},
|
||||
"setimmediate": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz",
|
||||
"integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU="
|
||||
},
|
||||
"tweetnacl": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz",
|
||||
"integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw=="
|
||||
},
|
||||
"ws": {
|
||||
"version": "7.5.1",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.1.tgz",
|
||||
"integrity": "sha512-2c6faOUH/nhoQN6abwMloF7Iyl0ZS2E9HGtsiLrWn0zOOMWlhtDmdf/uihDt6jnuCxgtwGBNy6Onsoy2s2O2Ow=="
|
||||
}
|
||||
}
|
||||
}
|
||||
+15
-8
@@ -1,19 +1,26 @@
|
||||
{
|
||||
"name": "supportbot",
|
||||
"version": "7.1-pre-2",
|
||||
"description": "SupportBot, a free open-source discord ticket application with ease of use.",
|
||||
"version": "7.7.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.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"supportbot": "node index.js"
|
||||
"start": "npm i && node index.js",
|
||||
"test": "node index.js test"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Emerald-Services/SupportBot.git"
|
||||
},
|
||||
"keywords": [
|
||||
"supportbot"
|
||||
],
|
||||
"author": "Emerald Services",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/Emerald-Services/SupportBot/issues"
|
||||
},
|
||||
"homepage": "https://github.com/Emerald-Services/SupportBot#readme",
|
||||
"dependencies": {
|
||||
"discord.js": "^12.5.3",
|
||||
"@vitalets/google-translate-api": "^8.0.0",
|
||||
"discord.js": "^13.6.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
"jsdom": "^16.7.0"
|
||||
"moment": "^2.29.3"
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
{}
|
||||
@@ -1 +0,0 @@
|
||||
{}
|
||||
@@ -1 +0,0 @@
|
||||
ReactionMessage_ID: ''
|
||||
@@ -1,327 +0,0 @@
|
||||
# ___ _ ___ _
|
||||
# / __> _ _ ___ ___ ___ _ _ _| |_ | . > ___ _| |_
|
||||
# \__ \| | || . \| . \/ . \| '_> | | | . \/ . \ | |
|
||||
# <___/`___|| _/| _/\___/|_| |_| |___/\___/ |_|
|
||||
# |_| |_|
|
||||
#
|
||||
# SupportBot created by Emerald Services
|
||||
# Installed with MIT License
|
||||
#
|
||||
# Discord Support: https://emeraldsrv.dev/discord
|
||||
|
||||
SupportBot_Version: "7.1 pre-2"
|
||||
|
||||
# -------------------------
|
||||
# General Configuration
|
||||
# -------------------------
|
||||
|
||||
Token: "BOT_TOKEN_HERE"
|
||||
Prefix: "!!"
|
||||
Bot_Name: "SupportBot"
|
||||
|
||||
DeleteMessages: true
|
||||
# Should the bot delete command messages after executed?
|
||||
|
||||
# -------------------------
|
||||
# Activity Configuration
|
||||
# -------------------------
|
||||
|
||||
BotActivity: "-help | SupportBot"
|
||||
|
||||
StreamingURL: "https://www.twitch.tv/YOUR_TWITCH_NAME"
|
||||
# Set The ActivityType to "STREAMING" for a streaming status!
|
||||
|
||||
ActivityType: "PLAYING"
|
||||
# Activity status can either be PLAYING, WATCHING, LISTENING or STREAMING.
|
||||
|
||||
# -------------------------
|
||||
# Embed Configuration
|
||||
# -------------------------
|
||||
|
||||
EmbedColour: "#f74343"
|
||||
EmbedFooter: "SupportBot | The #1 Supportive Discord Bot"
|
||||
|
||||
ErrorColour: "#d12519"
|
||||
SuccessColour: "#04b545"
|
||||
WarningColour: "#fca117"
|
||||
|
||||
# -------------------------
|
||||
# Help Configuration
|
||||
# -------------------------
|
||||
|
||||
HelpMenu: true # Do not change!
|
||||
SendHelpPage: "channel" # Set to channel or dm
|
||||
|
||||
# -------------------------
|
||||
# Role Configuration
|
||||
# -------------------------
|
||||
|
||||
AutoRole: true
|
||||
AutoRole_Role: "Member"
|
||||
LockdownRole: "@everyone"
|
||||
|
||||
Staff: "Staff"
|
||||
Admin: "Admin"
|
||||
TicketBlackListRole: "Blacklisted"
|
||||
|
||||
# -------------------------
|
||||
# Tickets Configuration
|
||||
# -------------------------
|
||||
|
||||
# --- General Config ---
|
||||
# --- Start ---
|
||||
|
||||
TicketCategory: "▬▬ TICKETS ▬▬"
|
||||
TicketChannel: "ticket"
|
||||
|
||||
TicketLog: "ticket-logs"
|
||||
TranscriptLog: "transcripts"
|
||||
|
||||
TranscriptTitle: "Ticket Transcript"
|
||||
TicketLog_Title: "Ticket Log"
|
||||
TicketBlackListMessage: "You are not allowed to open a ticket"
|
||||
|
||||
TicketSubject: "description"
|
||||
# "description" will displays the ticket reason within the channel description
|
||||
# "embed" will displays the ticket reason within the ticket embed
|
||||
|
||||
AllowTicketMentions: true
|
||||
# Set to true to allow the ticket to mention the author and the support team.
|
||||
# Set to false to dis-allow mentions within tickets.
|
||||
|
||||
# --- Panel Config ---
|
||||
# --- Start ---
|
||||
|
||||
ReactionChannel: "create-ticket"
|
||||
ReactionEmoji: "📩"
|
||||
# For cusomt emojis: <:emoji_name:EMOJI_ID>
|
||||
|
||||
ReactionTickets: true
|
||||
ReactionMessage: "React with %reaction_emoji% to create a Support Ticket!"
|
||||
|
||||
ReactionPanel_Description: true
|
||||
ReactionDescription: "Create a support ticket to contact a member of staff."
|
||||
|
||||
ReactionPanel_Thumbnail: true
|
||||
ReactionThumbnail: "https://hotemoji.com/images/dl/5/ticket-emoji-by-twitter.png"
|
||||
|
||||
ReactionPanel_Image: true
|
||||
ReactionImage: "https://wallpapercave.com/wp/wp4462546.jpg"
|
||||
|
||||
# --- Creation Config ---
|
||||
# --- Start ---
|
||||
|
||||
# Available Placeholders:
|
||||
|
||||
# %ticketusername% - User who created the ticket.
|
||||
# <@%ticketauthor%> - Tags the user who created the ticket.
|
||||
# <#%ticketid%> - Mentions the ticket channel.
|
||||
|
||||
|
||||
Ticket_Title: "Server Support | %ticketusername%"
|
||||
TicketMessage: "Hello <@%ticketauthor%>, Thank you for creating a support ticket\nPlease wait patiently whilst a member of our team reaches out to you."
|
||||
|
||||
Ticket_Thumbnail: "https://images.emojiterra.com/google/android-pie/512px/1f39f.png"
|
||||
NoTicketSubject: "No Reason Provided!"
|
||||
|
||||
TicketCreatedAlert: ":ticket: Your support ticket has been created: <#%ticketid%>"
|
||||
|
||||
AddedUser: "👍 <@%user%> has been added to this ticket"
|
||||
RemovedUser: "👍 <@%user%> has been removed from this ticket"
|
||||
|
||||
|
||||
TicketLockReaction: "🔒"
|
||||
TicketDeleteReaction: "⛔"
|
||||
|
||||
TranscriptSavedMessage: "📝 **Transcript Saved!**"
|
||||
TicketLockMessage: "❌ **Ticket Locked!**"
|
||||
TicketDeleteMessage: "⚠ **Ticket Deleting!**" # Tickets deleting after 5 seconds by default.
|
||||
TicketDeleteTime: 5000 # Time must be set in miliseconds.
|
||||
|
||||
# --- Closing Config ---
|
||||
# --- Start ---
|
||||
|
||||
ClosingTicket: ":warning: You have requested to close your support ticket."
|
||||
ClosingConfirmation_Word: "confirm"
|
||||
CloseConfirmation: true
|
||||
|
||||
# --- Departments Config ---
|
||||
# --- Start ---
|
||||
|
||||
TicketDepartments: true
|
||||
|
||||
AllowStaff: true
|
||||
# If set to true users with the "Staff" role will not be able to view tickets
|
||||
# without a valid department role set below.
|
||||
|
||||
# Set to false to allow "Staff" to see tickets whether its a department for them or not.
|
||||
|
||||
DepartmentEmoji_1: "🙋"
|
||||
DepartmentEmoji_2: "💸"
|
||||
DepartmentEmoji_3: "📗"
|
||||
# Ticket emojis, the emojis are what users will need to react with inorder to proceed furthur if departments are enabled.
|
||||
|
||||
DepartmentTitle_1: "Support"
|
||||
DepartmentTitle_2: "Billing"
|
||||
DepartmentTitle_3: "Other"
|
||||
# Ticket department title, This is the title for a ticket department to help users know what is available.
|
||||
|
||||
DepartmentRole_1: "Support"
|
||||
DepartmentRole_2: "Admin"
|
||||
DepartmentRole_3: "Support"
|
||||
# Ticket roles are the roles that will be able to gain access to tickets depending on what department has been choosen.
|
||||
|
||||
# --------------------------------
|
||||
# System Messages Configuration
|
||||
# --------------------------------
|
||||
|
||||
# Available Placeholders:
|
||||
# %guildname% - This displays the name of the discord server.
|
||||
|
||||
SystemMessages: true
|
||||
SystemMessage_EmbedFooter: false
|
||||
|
||||
SystemMessage_Channel: "system-messages"
|
||||
SystemMessage_Type: "embed"
|
||||
# There are 2 types of how you can send system messages, 'normal' or 'embed'
|
||||
|
||||
SystemMessage_Icon: "USER"
|
||||
# USER - This will display the user's icon of who joins.
|
||||
# BOT - This will display the bot's icon when a someone joins.
|
||||
# CUSTOM - This will allow you to use a custom image, set this below!
|
||||
SystemMessageIcon_URL: "https://imgur.com/example.png"
|
||||
|
||||
Welcome_Title: "User Joined!"
|
||||
WelcomeMessage: "Hello %member%, Welcome to %guildname%!"
|
||||
# %member% define the user who joined and %guildnamne% defines the server name.
|
||||
|
||||
Leave_Title: "User Left!"
|
||||
LeaveMessage: "Goodbye %member%, Thank you for visting %guildname%!"
|
||||
# %member% define the user who left and %guildnamne% defines the server name.
|
||||
|
||||
# -------------------------
|
||||
# Links Configuration
|
||||
# -------------------------
|
||||
|
||||
LinksTitle: "Server Links"
|
||||
|
||||
LINKS:
|
||||
"Website": "https://www.example.com"
|
||||
"Store": "https://store.example.com"
|
||||
"Discord": "https://discord.gg/example"
|
||||
# "Twitter": "https://twitter.com/example"
|
||||
# "Add More": "Just follow this format!"
|
||||
|
||||
# --------------------------
|
||||
# Suggestion Configuration
|
||||
# --------------------------
|
||||
|
||||
SuggestionChannel: "suggestions"
|
||||
SuggestionTitle: "Suggestion"
|
||||
|
||||
SuggestionStarter: "What would you like to suggest?"
|
||||
SuggestReact_1: 👍
|
||||
SuggestReact_2: 👎
|
||||
|
||||
SuggestionMessage_Icon: "USER"
|
||||
# USER - This will display the user's icon of who joins.
|
||||
# BOT - This will display the bot's icon when a someone joins.
|
||||
# CUSTOM - This will allow you to use a custom image, set this below!
|
||||
SuggestionIcon_URL: "https://imgur.com/example.png"
|
||||
|
||||
# ----------------------------
|
||||
# Announcement Configuration
|
||||
# ----------------------------
|
||||
|
||||
AnnouncementChannel: "announcements"
|
||||
AnnouncementTitle: "Servername Announcement"
|
||||
AnnouncementIcon: "https://i.imgur.com/HbkZyB7.png"
|
||||
|
||||
AnnouncementStarter: "What would you like to announce?"
|
||||
|
||||
# --------------------------
|
||||
# Moderation Configuration
|
||||
# --------------------------
|
||||
|
||||
ChatLog_Title: "Chat Log"
|
||||
ChatLogChannel: "chat-logs"
|
||||
ChatLogColour: "#1BA30C"
|
||||
ChatLog_Thumbnail: "https://cdn.iconscout.com/icon/free/png-256/chat-2639493-2187526.png"
|
||||
ChatLogSavedMessage: "📝 **Channel Transcript Saved!**"
|
||||
|
||||
BanTitle: "User Banned!"
|
||||
DaysBannedFor: 7
|
||||
BanLogColour: "#D911B4"
|
||||
|
||||
KickTitle: "User Kicked!"
|
||||
KickLogColour: "#D9B111"
|
||||
|
||||
ModThumbnail: "https://i.imgur.com/l6P3DF6.png"
|
||||
ModLogChannel: "mod-logs"
|
||||
|
||||
PruneLogTitle: "Bulk Delete"
|
||||
PruneThumbnail: "https://i.imgur.com/OAgW2vR.png"
|
||||
PruneColour: "#1BA30C"
|
||||
|
||||
BlacklistTitle: "Blacklisted User"
|
||||
BlacklistColour: "#000000"
|
||||
|
||||
# --------------------------
|
||||
# Command Configuration
|
||||
# --------------------------
|
||||
|
||||
# --- User Commands ---
|
||||
|
||||
HelpCommand: "help"
|
||||
LinksCommand: "links"
|
||||
PingCommand: "ping"
|
||||
SuggestCommand: "suggest"
|
||||
|
||||
# --- Ticket Commands ---
|
||||
|
||||
NewTicket: "ticket"
|
||||
CloseTicket: "close"
|
||||
AddUser: "add"
|
||||
RemoveUser: "remove"
|
||||
RenameTicket: "rename"
|
||||
|
||||
# --- Staff/Admin Commands ---
|
||||
|
||||
ChatLog: "transcript"
|
||||
BotSay: "say"
|
||||
PurgeMessage: "purge"
|
||||
|
||||
AnnounceCommand: "announce"
|
||||
BanUser: "ban"
|
||||
KickUser: "kick"
|
||||
BlacklistUser: "blacklist"
|
||||
|
||||
# --------------------------
|
||||
# Messages Configuration
|
||||
# --------------------------
|
||||
|
||||
# --- Command Messages ---
|
||||
|
||||
BotSayDesc: "Say something with the bot"
|
||||
ChatLogDesc: "Get a transcript of a channel"
|
||||
NewTicketDesc: "Create a new support ticket"
|
||||
AnnounceDesc: "Create a server announcement"
|
||||
CloseTicketDesc: "Close your support ticket"
|
||||
LinksDesc: "View some important links"
|
||||
PingDesc: "Get the bot's latency"
|
||||
HelpDesc: "Get a list of all the commands"
|
||||
RemoveUserDesc: "Remove a user from a support ticket"
|
||||
AddUserDesc: "Add a user to a support ticket"
|
||||
SuggestionDesc: "Create a server suggestion"
|
||||
BanDesc: "Ban a member from this server."
|
||||
KickDesc: "Kick a member from this server."
|
||||
PurgeDesc: "Purge messages from the chat."
|
||||
BlacklistDesc: "Decline a member to open a ticket"
|
||||
|
||||
# Error / Warning Messages
|
||||
|
||||
IncorrectPerms: ":x: **Err!** You do not have the correct permissions to use this command."
|
||||
InvalidChannel: ":x: **Err!** Channel not found. Please create it!"
|
||||
UserNotFound: ":x: **Err!** This user doesn't exist, Are they in this server?"
|
||||
NoValidTicket: ":warning: You cannot execute this command here. This command is used when closing a ticket."
|
||||
TicketExists: ":warning: This ticket cannot be opened, It already exists!"
|
||||
@@ -1,72 +0,0 @@
|
||||
// SupportBot Utils
|
||||
// Ticket Numbers
|
||||
|
||||
const discord = require("discord.js")
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
class TicketNumberID {
|
||||
|
||||
static pad(guildId) {
|
||||
let n = this.get(guildId) + '';
|
||||
let z = '0';
|
||||
let width = 4;
|
||||
setTimeout(() => {
|
||||
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) {
|
||||
|
||||
let ticketnumberID = JSON.parse(fs.readFileSync("./storage/TicketID.json", "utf8"));
|
||||
|
||||
if (!ticketnumberID[guildId]) {
|
||||
ticketnumberID[guildId] = {
|
||||
id: 0
|
||||
}
|
||||
|
||||
fs.writeFileSync("./storage/TicketID.json", JSON.stringify(ticketnumberID, null, 4), err => {
|
||||
if (err) console.log(err);
|
||||
});
|
||||
|
||||
return 0;
|
||||
|
||||
|
||||
} else {
|
||||
return ticketnumberID[guildId].id;
|
||||
}
|
||||
}
|
||||
|
||||
static set(guildId, value) {
|
||||
let ticketnumberID = JSON.parse(fs.readFileSync("./storage/TicketID.json", "utf8"));
|
||||
|
||||
ticketnumberID[guildId] = {
|
||||
id: value
|
||||
}
|
||||
|
||||
fs.writeFileSync("./storage/TicketID.json", JSON.stringify(ticketnumberID, null, 4), err => {
|
||||
if (err) console.log(err);
|
||||
});
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
static reset(guildId) {
|
||||
let ticketnumberID = JSON.parse(fs.readFileSync("./storage/TicketID.json", "utf8"));
|
||||
|
||||
ticketnumberID[guildId] = {
|
||||
id: 0
|
||||
}
|
||||
|
||||
fs.writeFileSync("./storage/TicketID.json", JSON.stringify(ticketnumberID, null, 4), err => {
|
||||
if (err) console.log(err);
|
||||
});
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = TicketNumberID;
|
||||
Reference in new issue
Block a user