SupportBot-7.2-Release
This commit is contained in:
1 parent
85667ddfad
commit
d4f95e752b
22 files changed
+1371
-1065
No files matched your search
+18
-21
@@ -4,31 +4,28 @@
|
||||
const fs = require("fs");
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./Data/supportbot.yml', 'utf8'));
|
||||
const cmdconfig = yaml.load(fs.readFileSync('./Data/commands.yml', 'utf8'));
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
|
||||
const cmdconfig = yaml.load(fs.readFileSync("./Data/commands.yml", "utf8"));
|
||||
|
||||
// Your Addon Config file! Saved in /Addons/Settings/YourAddonConig.yml
|
||||
// const exampleaddon = yaml.load(fs.readFileSync('./Addons/Settings/YourAddonConig.yml', 'utf8'));
|
||||
// Your Addon Config file! Saved in /Addons/Settings/YourAddonConfig.yml
|
||||
// const exampleaddon = yaml.load(fs.readFileSync('./Addons/Settings/YourAddonConfig.yml', 'utf8'));
|
||||
|
||||
const Command = require("../Structures/Command.js");
|
||||
|
||||
module.exports = new Command({
|
||||
name: "hello",
|
||||
description: "hello",
|
||||
type: "BOTH",
|
||||
slashCommandOptions: [],
|
||||
permission: "SEND_MESSAGES",
|
||||
name: "hello",
|
||||
description: "hello",
|
||||
slashCommandOptions: [],
|
||||
permission: "SEND_MESSAGES",
|
||||
|
||||
async run(message, args, client) {
|
||||
async run(interaction) {
|
||||
const Embed = new Discord.MessageEmbed()
|
||||
.setDescription("Hello World!")
|
||||
.setColor(supportbot.InfoColour);
|
||||
|
||||
const Embed = new Discord.MessageEmbed()
|
||||
.setDescription("Hello World!")
|
||||
.setColor(supportbot.InfoColour)
|
||||
|
||||
message.channel.send({
|
||||
embeds: [Embed]
|
||||
})
|
||||
|
||||
}
|
||||
});
|
||||
interaction.reply({
|
||||
embeds: [Embed],
|
||||
});
|
||||
},
|
||||
});
|
||||
+76
-56
@@ -1,75 +1,95 @@
|
||||
// SupportBot | Emerald Services
|
||||
// Info Command
|
||||
// Ticket Add Command
|
||||
|
||||
const fs = require("fs");
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./Data/supportbot.yml', 'utf8'));
|
||||
const cmdconfig = yaml.load(fs.readFileSync('./Data/commands.yml', 'utf8'));
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
|
||||
const cmdconfig = yaml.load(fs.readFileSync("./Data/commands.yml", "utf8"));
|
||||
|
||||
const Command = require("../Structures/Command.js");
|
||||
|
||||
async function asyncForEach(array, callback) {
|
||||
for (let index = 0; index < array.length; index++) {
|
||||
await callback(array[index], index, array);
|
||||
}
|
||||
for (let index = 0; index < array.length; index++) {
|
||||
await callback(array[index], index, array);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = new Command({
|
||||
name: cmdconfig.TicketAdd,
|
||||
description: cmdconfig.TicketAddDesc,
|
||||
type: "BOTH",
|
||||
slashCommandOptions: [],
|
||||
permission: "SEND_MESSAGES",
|
||||
name: cmdconfig.TicketAdd,
|
||||
description: cmdconfig.TicketAddDesc,
|
||||
slashCommandOptions: [
|
||||
{
|
||||
name: "user",
|
||||
description: "User to add",
|
||||
type: "USER",
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
permission: "SEND_MESSAGES",
|
||||
|
||||
async run(message, args, client) {
|
||||
async run(interaction) {
|
||||
let SupportStaff =
|
||||
interaction.guild.roles.cache.find(
|
||||
(SupportTeam) => SupportTeam.name === supportbot.Staff
|
||||
) ||
|
||||
interaction.guild.roles.cache.find(
|
||||
(SupportTeam) => SupportTeam.id === supportbot.Staff
|
||||
);
|
||||
let Admins =
|
||||
interaction.guild.roles.cache.find(
|
||||
(AdminUser) => AdminUser.name === supportbot.Admin
|
||||
) ||
|
||||
interaction.guild.roles.cache.find(
|
||||
(AdminUser) => AdminUser.id === supportbot.Admin
|
||||
);
|
||||
|
||||
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);
|
||||
|
||||
const NoPerms = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Permissions!")
|
||||
.setDescription(`${supportbot.IncorrectPerms}\n\nRole Required: \`${supportbot.Staff}\` or \`${supportbot.Admin}\``)
|
||||
.setColor(supportbot.WarningColour)
|
||||
if (
|
||||
interaction.member.roles.cache.has(SupportStaff.id) ||
|
||||
interaction.member.roles.cache.has(Admins.id)
|
||||
) {
|
||||
if (
|
||||
!interaction.channel.name.startsWith(`${supportbot.TicketChannel}-`)
|
||||
) {
|
||||
const Exists = new Discord.MessageEmbed()
|
||||
.setTitle("No Ticket Found!")
|
||||
.setDescription(`${supportbot.NoValidTicket}`)
|
||||
.setColor(supportbot.WarningColour);
|
||||
return interaction.reply({ embeds: [Exists] });
|
||||
}
|
||||
|
||||
if (message.member.roles.cache.has(SupportStaff.id) || message.member.roles.cache.has(Admins.id)) {
|
||||
if (!message.channel.name.startsWith( `${supportbot.TicketChannel}-` )) {
|
||||
const Exists = new Discord.MessageEmbed()
|
||||
.setTitle("No Ticket Found!")
|
||||
.setDescription(`${supportbot.NoValidTicket}`)
|
||||
.setColor(supportbot.WarningColour);
|
||||
message.channel.send({ embeds: [Exists] });
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
let uMember = message.mentions.users.first();
|
||||
const UserNotExist = new Discord.MessageEmbed()
|
||||
.setTitle("User Not Found!")
|
||||
.setDescription(`${supportbot.UserNotFound}\n\nTry Again:\`${supportbot.Prefix}${cmdconfig.TicketAdd} <user#0000>\``)
|
||||
.setColor(supportbot.ErrorColour)
|
||||
|
||||
if (!uMember) return message.channel.send({ embeds: [UserNotExist] });
|
||||
|
||||
message.channel.permissionOverwrites.edit(uMember, {
|
||||
VIEW_CHANNEL: true,
|
||||
READ_MESSAGE_HISTORY: true,
|
||||
SEND_MESSAGES: true,
|
||||
});
|
||||
|
||||
const Complete = new Discord.MessageEmbed()
|
||||
.setTitle("User Added!")
|
||||
.setDescription(supportbot.AddedUser.replace(/%user%/g, uMember.id))
|
||||
.setTimestamp()
|
||||
.setColor(supportbot.EmbedColour)
|
||||
message.channel.send({ embeds: [Complete] });
|
||||
} else {
|
||||
|
||||
return message.channel.send({ embeds: [NoPerms] });
|
||||
let uMember = interaction.options.getUser("user");
|
||||
const UserNotExist = new Discord.MessageEmbed()
|
||||
.setTitle("User Not Found!")
|
||||
.setDescription(
|
||||
`${supportbot.UserNotFound}\n\nTry Again:\`/${cmdconfig.TicketAdd} <user#0000>\``
|
||||
)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
|
||||
}
|
||||
if (!uMember) return interaction.reply({ embeds: [UserNotExist] });
|
||||
|
||||
interaction.channel.permissionOverwrites.edit(uMember, {
|
||||
VIEW_CHANNEL: true,
|
||||
READ_MESSAGE_HISTORY: true,
|
||||
SEND_MESSAGES: true,
|
||||
});
|
||||
|
||||
const Complete = new Discord.MessageEmbed()
|
||||
.setTitle("User Added!")
|
||||
.setDescription(supportbot.AddedUser.replace(/%user%/g, uMember.id))
|
||||
.setTimestamp()
|
||||
.setColor(supportbot.EmbedColour);
|
||||
interaction.reply({ embeds: [Complete] });
|
||||
} else {
|
||||
return interaction.reply({ embeds: [NoPerms] });
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
});
|
||||
+76
-56
@@ -1,75 +1,95 @@
|
||||
// SupportBot | Emerald Services
|
||||
// Info Command
|
||||
// Ticket Remove Command
|
||||
|
||||
const fs = require("fs");
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./Data/supportbot.yml', 'utf8'));
|
||||
const cmdconfig = yaml.load(fs.readFileSync('./Data/commands.yml', 'utf8'));
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
|
||||
const cmdconfig = yaml.load(fs.readFileSync("./Data/commands.yml", "utf8"));
|
||||
|
||||
const Command = require("../Structures/Command.js");
|
||||
|
||||
async function asyncForEach(array, callback) {
|
||||
for (let index = 0; index < array.length; index++) {
|
||||
await callback(array[index], index, array);
|
||||
}
|
||||
for (let index = 0; index < array.length; index++) {
|
||||
await callback(array[index], index, array);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = new Command({
|
||||
name: cmdconfig.TicketRemove,
|
||||
description: cmdconfig.TicketRemoveDesc,
|
||||
type: "BOTH",
|
||||
slashCommandOptions: [],
|
||||
permission: "SEND_MESSAGES",
|
||||
name: cmdconfig.TicketRemove,
|
||||
description: cmdconfig.TicketRemoveDesc,
|
||||
slashCommandOptions: [
|
||||
{
|
||||
name: "user",
|
||||
description: "User to remove",
|
||||
type: "USER",
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
permission: "SEND_MESSAGES",
|
||||
|
||||
async run(message, args, client) {
|
||||
async run(interaction) {
|
||||
let SupportStaff =
|
||||
interaction.guild.roles.cache.find(
|
||||
(SupportTeam) => SupportTeam.name === supportbot.Staff
|
||||
) ||
|
||||
interaction.guild.roles.cache.find(
|
||||
(SupportTeam) => SupportTeam.id === supportbot.Staff
|
||||
);
|
||||
let Admins =
|
||||
interaction.guild.roles.cache.find(
|
||||
(AdminUser) => AdminUser.name === supportbot.Admin
|
||||
) ||
|
||||
interaction.guild.roles.cache.find(
|
||||
(AdminUser) => AdminUser.id === supportbot.Admin
|
||||
);
|
||||
|
||||
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);
|
||||
|
||||
const NoPerms = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Permissions!")
|
||||
.setDescription(`${supportbot.IncorrectPerms}\n\nRole Required: \`${supportbot.Staff}\` or \`${supportbot.Admin}\``)
|
||||
.setColor(supportbot.WarningColour)
|
||||
if (
|
||||
interaction.member.roles.cache.has(SupportStaff.id) ||
|
||||
interaction.member.roles.cache.has(Admins.id)
|
||||
) {
|
||||
if (
|
||||
!interaction.channel.name.startsWith(`${supportbot.TicketChannel}-`)
|
||||
) {
|
||||
const Exists = new Discord.MessageEmbed()
|
||||
.setTitle("No Ticket Found!")
|
||||
.setDescription(`${supportbot.NoValidTicket}`)
|
||||
.setColor(supportbot.WarningColour);
|
||||
return interaction.reply({ embeds: [Exists] });
|
||||
}
|
||||
|
||||
if (message.member.roles.cache.has(SupportStaff.id) || message.member.roles.cache.has(Admins.id)) {
|
||||
if (!message.channel.name.startsWith( `${supportbot.TicketChannel}-` )) {
|
||||
const Exists = new Discord.MessageEmbed()
|
||||
.setTitle("No Ticket Found!")
|
||||
.setDescription(`${supportbot.NoValidTicket}`)
|
||||
.setColor(supportbot.WarningColour);
|
||||
message.channel.send({ embeds: [Exists] });
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
let uMember = message.mentions.users.first();
|
||||
const UserNotExist = new Discord.MessageEmbed()
|
||||
.setTitle("User Not Found!")
|
||||
.setDescription(`${supportbot.UserNotFound}\n\nTry Again:\`${supportbot.Prefix}${cmdconfig.TicketRemove} <user#0000>\``)
|
||||
.setColor(supportbot.ErrorColour)
|
||||
|
||||
if (!uMember) return message.channel.send({ embeds: [UserNotExist] });
|
||||
|
||||
message.channel.permissionOverwrites.edit(uMember, {
|
||||
VIEW_CHANNEL: false,
|
||||
READ_MESSAGE_HISTORY: false,
|
||||
SEND_MESSAGES: false,
|
||||
});
|
||||
|
||||
const Complete = new Discord.MessageEmbed()
|
||||
.setTitle("User Removed!")
|
||||
.setDescription(supportbot.RemovedUser.replace(/%user%/g, uMember.id))
|
||||
.setTimestamp()
|
||||
.setColor(supportbot.EmbedColour)
|
||||
message.channel.send({ embeds: [Complete] });
|
||||
} else {
|
||||
|
||||
return message.channel.send({ embeds: [NoPerms] });
|
||||
let uMember = interaction.options.getUser("user");
|
||||
const UserNotExist = new Discord.MessageEmbed()
|
||||
.setTitle("User Not Found!")
|
||||
.setDescription(
|
||||
`${supportbot.UserNotFound}\n\nTry Again:\`/${cmdconfig.TicketRemove} <user#0000>\``
|
||||
)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
|
||||
}
|
||||
if (!uMember) return interaction.reply({ embeds: [UserNotExist] });
|
||||
|
||||
interaction.channel.permissionOverwrites.edit(uMember, {
|
||||
VIEW_CHANNEL: false,
|
||||
READ_MESSAGE_HISTORY: false,
|
||||
SEND_MESSAGES: false,
|
||||
});
|
||||
|
||||
const Complete = new Discord.MessageEmbed()
|
||||
.setTitle("User Removed!")
|
||||
.setDescription(supportbot.RemovedUser.replace(/%user%/g, uMember.id))
|
||||
.setTimestamp()
|
||||
.setColor(supportbot.EmbedColour);
|
||||
interaction.reply({ embeds: [Complete] });
|
||||
} else {
|
||||
return interaction.reply({ embeds: [NoPerms] });
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
});
|
||||
+198
-145
@@ -4,171 +4,224 @@
|
||||
const fs = require("fs");
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./Data/supportbot.yml', 'utf8'));
|
||||
const cmdconfig = yaml.load(fs.readFileSync('./Data/commands.yml', 'utf8'));
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
|
||||
const cmdconfig = yaml.load(fs.readFileSync("./Data/commands.yml", "utf8"));
|
||||
|
||||
const Command = require("../Structures/Command.js");
|
||||
const TicketNumberID = require('../Structures/TicketID.js');
|
||||
const TicketNumberID = require("../Structures/TicketID.js");
|
||||
|
||||
async function asyncForEach(array, callback) {
|
||||
for (let index = 0; index < array.length; index++) {
|
||||
await callback(array[index], index, array);
|
||||
}
|
||||
for (let index = 0; index < array.length; index++) {
|
||||
await callback(array[index], index, array);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = new Command({
|
||||
name: cmdconfig.CloseTicket,
|
||||
description: cmdconfig.CloseTicketDesc,
|
||||
type: "BOTH",
|
||||
slashCommandOptions: [],
|
||||
permission: "SEND_MESSAGES",
|
||||
name: cmdconfig.CloseTicket,
|
||||
description: cmdconfig.CloseTicketDesc,
|
||||
slashCommandOptions: [
|
||||
{
|
||||
name: "reason",
|
||||
description: "Ticket Close Reason",
|
||||
type: "STRING",
|
||||
},
|
||||
],
|
||||
permission: "SEND_MESSAGES",
|
||||
|
||||
async run(message, args, client) {
|
||||
|
||||
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 });
|
||||
async run(interaction) {
|
||||
if (!interaction.channel.name.startsWith(`${supportbot.TicketChannel}-`)) {
|
||||
const Exists = new Discord.MessageEmbed()
|
||||
.setTitle("No Ticket Found!")
|
||||
.setDescription(`${supportbot.NoValidTicket}`)
|
||||
.setColor(supportbot.WarningColour);
|
||||
return interaction.reply({ embed: Exists });
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
interaction
|
||||
.reply(CloseTicketRequest)
|
||||
.then((m) => {
|
||||
interaction.channel
|
||||
.awaitMessages(
|
||||
(response) =>
|
||||
response.content.toLowerCase() ===
|
||||
supportbot.ClosingConfirmation_Word,
|
||||
{
|
||||
max: 1,
|
||||
time: 20000,
|
||||
errors: ["time"],
|
||||
}
|
||||
)
|
||||
.then((collected) => {
|
||||
let logChannel =
|
||||
interaction.guild.channels.cache.find(
|
||||
(channel) => channel.name === supportbot.TranscriptLog
|
||||
) ||
|
||||
interaction.guild.channels.cache.find(
|
||||
(channel) => channel.id === supportbot.TranscriptLog
|
||||
);
|
||||
let user = interaction.user;
|
||||
let reason =
|
||||
interaction.options.getString("reason") ||
|
||||
"No Reason Provided.";
|
||||
|
||||
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);
|
||||
let name = interaction.channel.name;
|
||||
let ticketChannel = interaction.channel;
|
||||
|
||||
message.channel.send(CloseTicketRequest).then(m => {
|
||||
message.channel.awaitMessages( response => response.content.toLowerCase() === supportbot.ClosingConfirmation_Word, {
|
||||
max: 1,
|
||||
time: 20000,
|
||||
errors: [ 'time' ],
|
||||
interaction
|
||||
.reply(`**${supportbot.ClosingTicket}**`)
|
||||
|
||||
|
||||
}).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.";
|
||||
.then(() => {
|
||||
const logEmbed = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.TranscriptTitle)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter(supportbot.EmbedFooter)
|
||||
.addField("Closed By", interaction.user.tag)
|
||||
.addField("Reason", reason);
|
||||
|
||||
let name = message.channel.name;
|
||||
let ticketChannel = message.channel;
|
||||
interaction.channel.interactions
|
||||
.fetch({ limit: 100 })
|
||||
.then((msgs) => {
|
||||
let html = "";
|
||||
|
||||
message.channel.send(`**${supportbot.ClosingTicket}**`)
|
||||
msgs = msgs.sort(
|
||||
(a, b) => a.createdTimestamp - b.createdTimestamp
|
||||
);
|
||||
html += `<strong>Server Name:</strong> ${interaction.guild.name}<br>`;
|
||||
html += `<strong>Ticket:</strong> ${ticketChannel.name}<br>`;
|
||||
html += `<strong>Message:</strong> ${msgs.size} Messages<br><br><br>`;
|
||||
|
||||
.then(() => {
|
||||
const logEmbed = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.TranscriptTitle)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter(supportbot.EmbedFooter)
|
||||
.addField("Closed By", message.author.tag)
|
||||
.addField("Reason", reason);
|
||||
msgs.forEach((msg) => {
|
||||
if (msg.content) {
|
||||
html += `<strong>User:</strong> ${msg.author.tag}<br>`;
|
||||
html += `<strong>Message:</strong> ${msg.content}<br>`;
|
||||
html += `-----<br><br>`;
|
||||
}
|
||||
});
|
||||
|
||||
message.channel.messages.fetch({ limit: 100 }).then( msgs => {
|
||||
let html = '';
|
||||
logChannel.send({ embeds: [logEmbed] }).catch((err) => {
|
||||
interaction.reply(err);
|
||||
});
|
||||
|
||||
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>`;
|
||||
let file = new Discord.MessageAttachment(
|
||||
Buffer.from(html),
|
||||
`${name}.html`
|
||||
);
|
||||
logChannel
|
||||
.send({ embeds: [logEmbed], files: [file] })
|
||||
.catch((err) => {
|
||||
interaction.reply(err);
|
||||
});
|
||||
|
||||
msgs.forEach( msg => {
|
||||
if ( msg.content ) {
|
||||
html += `<strong>User:</strong> ${msg.author.tag}<br>`;
|
||||
html += `<strong>Message:</strong> ${msg.content}<br>`;
|
||||
html += `-----<br><br>`;
|
||||
}
|
||||
});
|
||||
|
||||
logChannel.send({embeds: [logEmbed]}).catch(err => {
|
||||
message.reply(err)
|
||||
})
|
||||
|
||||
|
||||
let file = new Discord.MessageAttachment( Buffer.from( html ), `${name}.html` )
|
||||
logChannel.send({embeds: [logEmbed], files: [file]}).catch(err => {
|
||||
message.reply(err)
|
||||
})
|
||||
|
||||
message.channel.delete().catch(error => {
|
||||
if (error.code !== Discord.Constants.APIErrors.UNKNOWN_CHANNEL) {
|
||||
console.error('Failed to delete the message:', error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
}).catch( () => {
|
||||
interaction.m.edit({content: 'The request to close the ticket has timed out.'}).then(m2 => setTimeout(() => channel.delete(3000)) );
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
if (!supportbot.CloseConfirmation) {
|
||||
|
||||
let logChannel = message.guild.channels.cache.find(channel => channel.name === supportbot.TranscriptLog) || message.guild.channels.cache.find(channel => channel.id === supportbot.TranscriptLog)
|
||||
let user = message.author;
|
||||
let reason = args.join(" ") || "No Reason Provided.";
|
||||
|
||||
let name = message.channel.name;
|
||||
let ticketChannel = message.channel;
|
||||
|
||||
message.channel.send(`**${supportbot.ClosingTicket}**`)
|
||||
|
||||
.then(() => {
|
||||
const logEmbed = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.TranscriptTitle)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter(supportbot.EmbedFooter)
|
||||
.addField("Closed By", message.author.tag)
|
||||
.addField("Reason", reason);
|
||||
|
||||
message.channel.messages.fetch({ limit: 100 }).then( msgs => {
|
||||
let html = '';
|
||||
|
||||
msgs = msgs.sort( ( a, b ) => a.createdTimestamp - b.createdTimestamp );
|
||||
html += `<strong>Server Name:</strong> ${message.guild.name}<br>`;
|
||||
html += `<strong>Ticket:</strong> ${ticketChannel.name}<br>`;
|
||||
html += `<strong>Message:</strong> ${msgs.size} Messages<br><br><br>`;
|
||||
|
||||
msgs.forEach( msg => {
|
||||
if ( msg.content ) {
|
||||
html += `<strong>User:</strong> ${msg.author.tag}<br>`;
|
||||
html += `<strong>Message:</strong> ${msg.content}<br>`;
|
||||
html += `-----<br><br>`;
|
||||
}
|
||||
});
|
||||
|
||||
logChannel.send({embeds: [logEmbed]}).catch(err => {
|
||||
message.reply(err)
|
||||
})
|
||||
|
||||
let file = new Discord.MessageAttachment( Buffer.from( html ), `${name}.html` )
|
||||
logChannel.send({embeds: [logEmbed], files: [file]}).catch(err => {
|
||||
message.reply(err)
|
||||
})
|
||||
|
||||
message.channel.delete().catch(error => {
|
||||
if (error.code !== Discord.Constants.APIErrors.UNKNOWN_CHANNEL) {
|
||||
console.error('Failed to delete the message:', error);
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
}).catch( () => {
|
||||
interaction.m.edit({content: 'The request to close the ticket has timed out.'}).then(m2 => setTimeout(() => channel.delete(3000)) );
|
||||
interaction.channel.delete().catch((error) => {
|
||||
if (
|
||||
error.code !==
|
||||
Discord.Constants.APIErrors.UNKNOWN_CHANNEL
|
||||
) {
|
||||
console.error(
|
||||
"Failed to delete the interaction:",
|
||||
error
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
interaction
|
||||
.followUp({
|
||||
content: "The request to close the ticket has timed out.",
|
||||
})
|
||||
.then((m2) => setTimeout(() => interaction.channel.delete(3000)));
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
if (!supportbot.CloseConfirmation) {
|
||||
let logChannel =
|
||||
interaction.guild.channels.cache.find(
|
||||
(channel) => channel.name === supportbot.TranscriptLog
|
||||
) ||
|
||||
interaction.guild.channels.cache.find(
|
||||
(channel) => channel.id === supportbot.TranscriptLog
|
||||
);
|
||||
let user = interaction.user;
|
||||
let reason =
|
||||
(await interaction.options.getString("reason")) ||
|
||||
"No Reason Provided.";
|
||||
|
||||
}
|
||||
let name = interaction.channel.name;
|
||||
let ticketChannel = interaction.channel;
|
||||
|
||||
interaction
|
||||
.reply(`**${supportbot.ClosingTicket}**`)
|
||||
|
||||
.then(() => {
|
||||
const logEmbed = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.TranscriptTitle)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter(supportbot.EmbedFooter)
|
||||
.addField("Closed By", interaction.user.tag)
|
||||
.addField("Reason", reason);
|
||||
|
||||
interaction.channel.interactions
|
||||
.fetch({ limit: 100 })
|
||||
.then((msgs) => {
|
||||
let html = "";
|
||||
|
||||
msgs = msgs.sort(
|
||||
(a, b) => a.createdTimestamp - b.createdTimestamp
|
||||
);
|
||||
html += `<strong>Server Name:</strong> ${interaction.guild.name}<br>`;
|
||||
html += `<strong>Ticket:</strong> ${ticketChannel.name}<br>`;
|
||||
html += `<strong>Message:</strong> ${msgs.size} Messages<br><br><br>`;
|
||||
|
||||
msgs.forEach((msg) => {
|
||||
if (msg.content) {
|
||||
html += `<strong>User:</strong> ${msg.author.tag}<br>`;
|
||||
html += `<strong>Message:</strong> ${msg.content}<br>`;
|
||||
html += `-----<br><br>`;
|
||||
}
|
||||
});
|
||||
|
||||
logChannel.send({ embeds: [logEmbed] }).catch((err) => {
|
||||
interaction.reply(err);
|
||||
});
|
||||
|
||||
let file = new Discord.MessageAttachment(
|
||||
Buffer.from(html),
|
||||
`${name}.html`
|
||||
);
|
||||
logChannel
|
||||
.send({ embeds: [logEmbed], files: [file] })
|
||||
.catch((err) => {
|
||||
interaction.reply(err);
|
||||
});
|
||||
|
||||
interaction.channel.delete().catch((error) => {
|
||||
if (
|
||||
error.code !== Discord.Constants.APIErrors.UNKNOWN_CHANNEL
|
||||
) {
|
||||
console.error("Failed to delete the interaction:", error);
|
||||
}
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
interaction
|
||||
.followUp({
|
||||
content: "The request to close the ticket has timed out.",
|
||||
})
|
||||
.then((m2) => setTimeout(() => interaction.channel.delete(3000)));
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,78 @@
|
||||
// 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("./Data/supportbot.yml", "utf8"));
|
||||
const cmdconfig = yaml.load(fs.readFileSync("./Data/commands.yml", "utf8"));
|
||||
|
||||
const Command = require("../Structures/Command.js");
|
||||
|
||||
module.exports = new Command({
|
||||
name: cmdconfig.EmbedCommand,
|
||||
description: cmdconfig.EmbedCommandDesc,
|
||||
slashCommandOptions: [
|
||||
{
|
||||
name: "title",
|
||||
description: "Embed Title",
|
||||
type: "STRING",
|
||||
},
|
||||
|
||||
{
|
||||
name: "message",
|
||||
description: "Embed Message",
|
||||
type: "STRING",
|
||||
},
|
||||
|
||||
],
|
||||
permission: "SEND_MESSAGES",
|
||||
|
||||
async run(interaction) {
|
||||
|
||||
let SupportStaff =
|
||||
interaction.guild.roles.cache.find(
|
||||
(SupportTeam) => SupportTeam.name === supportbot.Staff
|
||||
) ||
|
||||
interaction.guild.roles.cache.find(
|
||||
(SupportTeam) => SupportTeam.id === supportbot.Staff
|
||||
);
|
||||
let Admins =
|
||||
interaction.guild.roles.cache.find(
|
||||
(AdminUser) => AdminUser.name === supportbot.Admin
|
||||
) ||
|
||||
interaction.guild.roles.cache.find(
|
||||
(AdminUser) => AdminUser.id === supportbot.Admin
|
||||
);
|
||||
|
||||
const NoPerms = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid Permissions!")
|
||||
.setDescription(
|
||||
`${supportbot.IncorrectPerms}\n\nRole Required: \`${supportbot.Staff}\` or \`${supportbot.Admin}\``
|
||||
)
|
||||
.setColor(supportbot.WarningColour);
|
||||
|
||||
if (
|
||||
interaction.member.roles.cache.has(SupportStaff.id) ||
|
||||
interaction.member.roles.cache.has(Admins.id)
|
||||
) {
|
||||
|
||||
const EmbedTitle = interaction.options.getString("title")
|
||||
const EmbedSubject = interaction.options.getString("message")
|
||||
|
||||
const EmbedMsg = new Discord.MessageEmbed()
|
||||
.setTitle(EmbedTitle)
|
||||
.setDescription(EmbedSubject)
|
||||
|
||||
interaction.reply({
|
||||
embeds: [EmbedMsg],
|
||||
});
|
||||
|
||||
} else {
|
||||
return interaction.reply({ embeds: [NoPerms] });
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
});
|
||||
+87
-69
@@ -1,86 +1,104 @@
|
||||
// SupportBot | Emerald Services
|
||||
// Close Ticket Command
|
||||
// Help Command
|
||||
|
||||
const fs = require("fs");
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./Data/supportbot.yml', 'utf8'));
|
||||
const cmdconfig = yaml.load(fs.readFileSync('./Data/commands.yml', 'utf8'));
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
|
||||
const cmdconfig = yaml.load(fs.readFileSync("./Data/commands.yml", "utf8"));
|
||||
|
||||
const Command = require("../Structures/Command.js");
|
||||
const TicketNumberID = require('../Structures/TicketID.js');
|
||||
|
||||
async function asyncForEach(array, callback) {
|
||||
for (let index = 0; index < array.length; index++) {
|
||||
await callback(array[index], index, array);
|
||||
}
|
||||
for (let index = 0; index < array.length; index++) {
|
||||
await callback(array[index], index, array);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = new Command({
|
||||
name: cmdconfig.HelpCommand,
|
||||
description: cmdconfig.HelpCommandDesc,
|
||||
type: "BOTH",
|
||||
slashCommandOptions: [],
|
||||
permission: "SEND_MESSAGES",
|
||||
name: cmdconfig.HelpCommand,
|
||||
description: cmdconfig.HelpCommandDesc,
|
||||
slashCommandOptions: [],
|
||||
permission: "SEND_MESSAGES",
|
||||
|
||||
async run(message, args, client) {
|
||||
async run(interaction) {
|
||||
let SupportStaff =
|
||||
interaction.guild.roles.cache.find(
|
||||
(adminRole) => adminRole.name === supportbot.Staff
|
||||
) ||
|
||||
interaction.guild.roles.cache.find(
|
||||
(staffRole) => staffRole.id === supportbot.Staff
|
||||
);
|
||||
let AdminStaff =
|
||||
interaction.guild.roles.cache.find(
|
||||
(adminRole) => adminRole.name === supportbot.Admin
|
||||
) ||
|
||||
interaction.guild.roles.cache.find(
|
||||
(adminRole) => adminRole.id === supportbot.Admin
|
||||
);
|
||||
|
||||
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 botCommands = "";
|
||||
botCommands += `**${supportbot.Prefix}${cmdconfig.HelpCommand}** ${cmdconfig.HelpCommandDesc}\n`;
|
||||
botCommands += `**${supportbot.Prefix}${cmdconfig.InfoCommand}** ${cmdconfig.InfoCommandDesc}\n`;
|
||||
botCommands += `**${supportbot.Prefix}${cmdconfig.PingCommand}** ${cmdconfig.PingCommandDesc}\n`
|
||||
|
||||
let ticketCommands = "";
|
||||
ticketCommands += `**${supportbot.Prefix}${cmdconfig.OpenTicket}** ${cmdconfig.OpenTicketDesc}\n`;
|
||||
ticketCommands += `**${supportbot.Prefix}${cmdconfig.CloseTicket}** ${cmdconfig.CloseTicketDesc}\n`
|
||||
if (supportbot.HelpMenu) {
|
||||
let botCommands = "";
|
||||
botCommands += `**/${cmdconfig.HelpCommand}** ${cmdconfig.HelpCommandDesc}\n`;
|
||||
botCommands += `**/${cmdconfig.InfoCommand}** ${cmdconfig.InfoCommandDesc}\n`;
|
||||
botCommands += `**/${cmdconfig.PingCommand}** ${cmdconfig.PingCommandDesc}\n`;
|
||||
|
||||
let staffCommands = "";
|
||||
staffCommands += `**${supportbot.Prefix}${cmdconfig.TicketAdd}** ${cmdconfig.TicketAddDesc}\n`
|
||||
staffCommands += `**${supportbot.Prefix}${cmdconfig.TicketRemove}** ${cmdconfig.TicketRemoveDesc}\n`
|
||||
|
||||
const HelpEmbed1 = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.Name)
|
||||
.setThumbnail(message.author.displayAvatarURL())
|
||||
|
||||
.addFields(
|
||||
{ name: '🖥️ General Commands\n', value: `${botCommands}\n`, inline: false },
|
||||
{ name: '🎫 Support Commands\n', value: `${ticketCommands}\n`, inline: false },
|
||||
)
|
||||
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter(supportbot.EmbedFooter, message.author.displayAvatarURL());
|
||||
|
||||
if (message.member.roles.cache.has(SupportStaff.id)) {
|
||||
HelpEmbed1.addFields(
|
||||
{ name: '🔐 Staff Commands\n', value: `${staffCommands}\n`, inline: false },
|
||||
)
|
||||
} else {
|
||||
if ((message.member.roles.cache.has(AdminStaff.id))) {
|
||||
HelpEmbed1.addFields(
|
||||
{ name: '🔐 Staff Commands\n', value: `${staffCommands}\n`, inline: false },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (supportbot.SendHelpPage === "dm") {
|
||||
message.author.send({
|
||||
embeds: [HelpEmbed1]
|
||||
});
|
||||
}
|
||||
|
||||
if (supportbot.SendHelpPage === "channel") {
|
||||
message.channel.send({
|
||||
embeds: [HelpEmbed1]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
let ticketCommands = "";
|
||||
ticketCommands += `**/${cmdconfig.OpenTicket}** ${cmdconfig.OpenTicketDesc}\n`;
|
||||
ticketCommands += `**/${cmdconfig.CloseTicket}** ${cmdconfig.CloseTicketDesc}\n`;
|
||||
|
||||
let staffCommands = "";
|
||||
staffCommands += `**/${cmdconfig.TicketAdd}** ${cmdconfig.TicketAddDesc}\n`;
|
||||
staffCommands += `**/${cmdconfig.TicketRemove}** ${cmdconfig.TicketRemoveDesc}\n`;
|
||||
|
||||
const HelpEmbed1 = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.Name + " Commands")
|
||||
.setThumbnail(interaction.user.displayAvatarURL())
|
||||
|
||||
.addFields(
|
||||
{
|
||||
name: "🖥️ General Commands\n",
|
||||
value: `${botCommands}\n`,
|
||||
inline: false,
|
||||
},
|
||||
{
|
||||
name: "🎫 Support Commands\n",
|
||||
value: `${ticketCommands}\n`,
|
||||
inline: false,
|
||||
}
|
||||
)
|
||||
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter(supportbot.EmbedFooter, interaction.user.displayAvatarURL());
|
||||
|
||||
if (interaction.member.roles.cache.has(SupportStaff.id)) {
|
||||
HelpEmbed1.addFields({
|
||||
name: "🔐 Staff Commands\n",
|
||||
value: `${staffCommands}\n`,
|
||||
inline: false,
|
||||
});
|
||||
} else {
|
||||
if (interaction.member.roles.cache.has(AdminStaff.id)) {
|
||||
HelpEmbed1.addFields({
|
||||
name: "🔐 Staff Commands\n",
|
||||
value: `${staffCommands}\n`,
|
||||
inline: false,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (supportbot.SendHelpPage === "dm") {
|
||||
interaction.user.reply({
|
||||
embeds: [HelpEmbed1],
|
||||
});
|
||||
}
|
||||
|
||||
if (supportbot.SendHelpPage === "channel") {
|
||||
interaction.reply({
|
||||
embeds: [HelpEmbed1],
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
+24
-28
@@ -4,39 +4,35 @@
|
||||
const fs = require("fs");
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./Data/supportbot.yml', 'utf8'));
|
||||
const cmdconfig = yaml.load(fs.readFileSync('./Data/commands.yml', 'utf8'));
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
|
||||
const cmdconfig = yaml.load(fs.readFileSync("./Data/commands.yml", "utf8"));
|
||||
|
||||
const Command = require("../Structures/Command.js");
|
||||
|
||||
module.exports = new Command({
|
||||
name: cmdconfig.InfoCommand,
|
||||
description: cmdconfig.InfoCommandDesc,
|
||||
type: "BOTH",
|
||||
slashCommandOptions: [],
|
||||
permission: "SEND_MESSAGES",
|
||||
name: cmdconfig.InfoCommand,
|
||||
description: cmdconfig.InfoCommandDesc,
|
||||
slashCommandOptions: [],
|
||||
permission: "SEND_MESSAGES",
|
||||
|
||||
async run(message, args, client) {
|
||||
async run(interaction) {
|
||||
const InfoButton = new Discord.MessageButton()
|
||||
.setLabel(supportbot.InfoButtonText)
|
||||
.setURL(supportbot.InfoURL)
|
||||
.setStyle("LINK");
|
||||
|
||||
const InfoButton = new Discord.MessageButton()
|
||||
.setLabel(supportbot.InfoButtonText)
|
||||
.setURL(supportbot.InfoURL)
|
||||
.setStyle('LINK')
|
||||
const inforow = new Discord.MessageActionRow().addComponents(InfoButton);
|
||||
|
||||
const inforow = new Discord.MessageActionRow()
|
||||
.addComponents(InfoButton)
|
||||
const InfoEmbed = new Discord.MessageEmbed()
|
||||
.setURL(supportbot.InfoURL)
|
||||
.setTitle(supportbot.InfoTitle)
|
||||
.setDescription(supportbot.AboutMe)
|
||||
.setColor(supportbot.InfoColour);
|
||||
|
||||
const InfoEmbed = new Discord.MessageEmbed()
|
||||
.setURL(supportbot.InfoURL)
|
||||
.setTitle(supportbot.InfoTitle)
|
||||
.setDescription(supportbot.AboutMe)
|
||||
.setColor(supportbot.InfoColour)
|
||||
|
||||
|
||||
message.channel.send({
|
||||
embeds: [InfoEmbed], components: [inforow]
|
||||
})
|
||||
|
||||
}
|
||||
});
|
||||
interaction.reply({
|
||||
embeds: [InfoEmbed],
|
||||
components: [inforow],
|
||||
});
|
||||
},
|
||||
});
|
||||
+4
-2
@@ -14,13 +14,14 @@
|
||||
# Commamnd Name Configuration
|
||||
# -------------------------------
|
||||
|
||||
TicketAdd: "ticketadd"
|
||||
TicketRemove: "ticketremove"
|
||||
TicketAdd: "add"
|
||||
TicketRemove: "remove"
|
||||
OpenTicket: "ticket"
|
||||
CloseTicket: "close"
|
||||
InfoCommand: "info"
|
||||
PingCommand: "ping"
|
||||
HelpCommand: "help"
|
||||
EmbedCommand: "embed"
|
||||
|
||||
# ---------------------------------------
|
||||
# Commamnd Description Configuration
|
||||
@@ -33,5 +34,6 @@ 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."
|
||||
|
||||
|
||||
+2
-2
@@ -17,14 +17,14 @@ SupportBot_Version: "7.2 pre-3"
|
||||
# -------------------------
|
||||
|
||||
Name: "SupportBot"
|
||||
Prefix: "!"
|
||||
Prefix: "!" # Everything uses the new Slash (/) Commands feature!
|
||||
Token: "BOT_TOKEN"
|
||||
|
||||
# -------------------------
|
||||
# Activity Configuration
|
||||
# -------------------------
|
||||
|
||||
BotActivity: "Need Help? -ticket"
|
||||
BotActivity: "Need Help? /ticket"
|
||||
|
||||
StreamingURL: "https://www.twitch.tv/YOUR_TWITCH_NAME"
|
||||
# Set The ActivityType to "STREAMING" for a streaming status!
|
||||
|
||||
@@ -1 +1 @@
|
||||
TicketPanelID: '896035054235574362'
|
||||
TicketPanelID: ''
|
||||
@@ -4,37 +4,40 @@
|
||||
const fs = require("fs");
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./Data/supportbot.yml', 'utf8'));
|
||||
const cmdconfig = yaml.load(fs.readFileSync('./Data/commands.yml', 'utf8'));
|
||||
const panelconfig = yaml.load(fs.readFileSync('./Data/ticket-panel.yml', 'utf8'));
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
|
||||
const cmdconfig = yaml.load(fs.readFileSync("./Data/commands.yml", "utf8"));
|
||||
const panelconfig = yaml.load(
|
||||
fs.readFileSync("./Data/ticket-panel.yml", "utf8")
|
||||
);
|
||||
|
||||
const Event = require("../Structures/Event.js");
|
||||
|
||||
module.exports = new Event("messageReactionAdd", async (client) => {
|
||||
let message = {
|
||||
guild: reaction.message.channel.guild,
|
||||
author: user,
|
||||
content: "N/A",
|
||||
channel: reaction.message.channel,
|
||||
};
|
||||
|
||||
let message = {
|
||||
guild: reaction.message.channel.guild,
|
||||
author: user,
|
||||
content: "N/A",
|
||||
channel: reaction.message.channel
|
||||
}
|
||||
if (panelconfig.TicketPanel) {
|
||||
if (reaction.message.id === panelconfig.TicketPanelID) {
|
||||
if (
|
||||
reaction.emoji.name == panelconfig.ButtonEmoji ||
|
||||
reaction.emoji.id == panelconfig.ButtonEmoji
|
||||
) {
|
||||
await reaction.users.remove(user.id);
|
||||
|
||||
if (panelconfig.TicketPanel) {
|
||||
if (reaction.message.id === panelconfig.TicketPanelID) {
|
||||
if (reaction.emoji.name == panelconfig.ButtonEmoji || reaction.emoji.id == panelconfig.ButtonEmoji) {
|
||||
await reaction.users.remove(user.id)
|
||||
try {
|
||||
const cmd = client.commands.get(cmdconfig.OpenTicket);
|
||||
if (!cmd) return;
|
||||
|
||||
try {
|
||||
const cmd = client.commands.get(cmdconfig.OpenTicket);
|
||||
if(!cmd) return;
|
||||
|
||||
cmd.run(message, message.content);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
cmd.run(message, message.content);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
+62
-66
@@ -8,96 +8,92 @@ const Command = require("./Command.js");
|
||||
const Event = require("./Event.js");
|
||||
const intents = new Discord.Intents(32767);
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./Data/supportbot.yml', 'utf8'));
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
|
||||
|
||||
class Client extends Discord.Client {
|
||||
constructor() {
|
||||
super({ intents });
|
||||
constructor() {
|
||||
super({ intents });
|
||||
|
||||
this.commands = new Discord.Collection();
|
||||
this.commands = new Discord.Collection();
|
||||
}
|
||||
|
||||
this.prefix = supportbot.Prefix;
|
||||
}
|
||||
start(token) {
|
||||
const commandFiles = fs
|
||||
.readdirSync("./Commands")
|
||||
.filter((file) => file.endsWith(".js"));
|
||||
|
||||
start(token) {
|
||||
const commandFiles = fs.readdirSync("./Commands")
|
||||
.filter(file => file.endsWith(".js"));
|
||||
const commands = commandFiles.map((file) => require(`../Commands/${file}`));
|
||||
|
||||
const commands = commandFiles.map(file => require(`../Commands/${file}`));
|
||||
console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ 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);
|
||||
});
|
||||
|
||||
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 ▬▬▬▬▬▬▬");
|
||||
|
||||
console.log(`\u001b[34;1m`, '▬▬▬▬▬▬▬ Commands ▬▬▬▬▬▬▬')
|
||||
// Addons
|
||||
|
||||
// Addons
|
||||
const addonFiles = fs
|
||||
.readdirSync("./Addons")
|
||||
.filter((file) => file.endsWith(".js"));
|
||||
|
||||
const addonFiles = fs.readdirSync("./Addons")
|
||||
.filter(file => file.endsWith(".js"));
|
||||
const addons = addonFiles.map((file) => require(`../Addons/${file}`));
|
||||
|
||||
const addons = addonFiles.map(file => require(`../Addons/${file}`));
|
||||
console.log(" ");
|
||||
console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Addons ▬▬▬▬▬▬▬");
|
||||
|
||||
console.log(' ')
|
||||
console.log(`\u001b[34;1m`, '▬▬▬▬▬▬▬ Addons ▬▬▬▬▬▬▬')
|
||||
addons.forEach((addon) => {
|
||||
console.log(`\u001b[31;1m`, `${addon.name}`, `\u001b[32;1m`, "Loaded");
|
||||
this.commands.set(addon.name, addon);
|
||||
});
|
||||
|
||||
addons.forEach(addon => {
|
||||
console.log(`\u001b[31;1m`, `${addon.name}`, `\u001b[32;1m`, 'Loaded');
|
||||
this.commands.set(addon.name, addon);
|
||||
});
|
||||
console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Addons ▬▬▬▬▬▬▬");
|
||||
console.log(" ");
|
||||
|
||||
console.log(`\u001b[34;1m`, '▬▬▬▬▬▬▬ Addons ▬▬▬▬▬▬▬')
|
||||
console.log(' ')
|
||||
// Slash Commands
|
||||
|
||||
// Slash Commands
|
||||
const slashCommands = commands.map((cmd) => ({
|
||||
name: cmd.name.toLowerCase(),
|
||||
description: cmd.description,
|
||||
permissions: [],
|
||||
options: cmd.slashCommandOptions,
|
||||
defaultPermission: true,
|
||||
}));
|
||||
|
||||
const slashCommands = commands
|
||||
.filter(cmd => ["BOTH", "SLASH"].includes(cmd.type))
|
||||
.map(cmd => ({
|
||||
name: cmd.name.toLowerCase(),
|
||||
description: cmd.description,
|
||||
permissions: [],
|
||||
options: cmd.slashCommandOptions,
|
||||
defaultPermission: true
|
||||
}));
|
||||
this.removeAllListeners();
|
||||
|
||||
this.removeAllListeners();
|
||||
this.on("ready", async () => {
|
||||
const cmds = await this.application?.commands.set(slashCommands);
|
||||
|
||||
this.on("ready", async () => {
|
||||
const cmds = await this.application.commands.set(slashCommands);
|
||||
console.log(" ");
|
||||
console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Slash Command ▬▬▬▬▬▬▬"),
|
||||
console.log(" ");
|
||||
|
||||
console.log(' ')
|
||||
console.log(`\u001b[34;1m`, '▬▬▬▬▬▬▬ Slash Command ▬▬▬▬▬▬▬'),
|
||||
console.log(' ')
|
||||
cmds.forEach((cmd) =>
|
||||
console.log(`Slash Command ${cmd.name} registered`)
|
||||
);
|
||||
});
|
||||
|
||||
cmds.forEach(cmd =>
|
||||
console.log(`Slash Command ${cmd.name} registered`),
|
||||
)
|
||||
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");
|
||||
|
||||
console.log(' ')
|
||||
console.log(`\u001b[34;1m`, '▬▬▬▬▬▬▬ Events ▬▬▬▬▬▬▬')
|
||||
this.on(event.event, event.run.bind(null, this));
|
||||
});
|
||||
|
||||
fs.readdirSync("./Events")
|
||||
.filter(file => file.endsWith(".js"))
|
||||
.forEach(file => {
|
||||
console.log(`\u001b[34;1m`, "▬▬▬▬▬▬▬ Events ▬▬▬▬▬▬▬");
|
||||
console.log(" ");
|
||||
|
||||
const event = require(`../Events/${file}`);
|
||||
console.log(`\u001b[31;1m`, `${event.event}`, `\u001b[32;1m`, 'Loaded');
|
||||
|
||||
this.on(event.event, event.run.bind(null, this));
|
||||
});
|
||||
|
||||
console.log(`\u001b[34;1m`, '▬▬▬▬▬▬▬ Events ▬▬▬▬▬▬▬')
|
||||
console.log(' ')
|
||||
|
||||
this.login(token);
|
||||
}
|
||||
this.login(token);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Client;
|
||||
module.exports = Client;
|
||||
+11
-12
@@ -5,20 +5,19 @@ const fs = require("fs");
|
||||
|
||||
const Discord = require("discord.js");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./Data/supportbot.yml', 'utf8'));
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
|
||||
|
||||
function RunFunction(message, args, client) {}
|
||||
function RunFunction(interaction) {}
|
||||
|
||||
class Command {
|
||||
constructor(options) {
|
||||
this.name = options.name;
|
||||
this.description = options.description;
|
||||
this.permission = options.permission;
|
||||
this.type = ["BOTH", "SLASH", "TEXT"].includes(options.type) ? options.type : "TEXT";
|
||||
this.slashCommandOptions = options.slashCommandOptions || [];
|
||||
this.run = options.run;
|
||||
}
|
||||
constructor(options) {
|
||||
this.name = options.name;
|
||||
this.description = options.description;
|
||||
this.permission = options.permission;
|
||||
this.slashCommandOptions = options.slashCommandOptions || [];
|
||||
this.run = options.run;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Command;
|
||||
module.exports = Command;
|
||||
+7
-8
@@ -5,17 +5,16 @@ const fs = require("fs");
|
||||
|
||||
const Discord = require("discord.js");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./Data/supportbot.yml', 'utf8'));
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
|
||||
|
||||
function RunFunction(client, ...eventArgs) {}
|
||||
|
||||
class Event {
|
||||
|
||||
constructor(event, runFunction) {
|
||||
this.event = event;
|
||||
this.run = runFunction;
|
||||
}
|
||||
constructor(event, runFunction) {
|
||||
this.event = event;
|
||||
this.run = runFunction;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Event;
|
||||
module.exports = Event;
|
||||
+57
-43
@@ -8,69 +8,83 @@ const Command = require("./Command.js");
|
||||
const Client = require("./Client.js");
|
||||
const Event = require("./Event.js");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./Data/supportbot.yml', 'utf8'));
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.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 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("./Data/TicketData.json", "utf8"));
|
||||
static get(guildId) {
|
||||
let ticketnumberID = JSON.parse(
|
||||
fs.readFileSync("./Data/TicketData.json", "utf8")
|
||||
);
|
||||
|
||||
if (!ticketnumberID[guildId]) {
|
||||
ticketnumberID[guildId] = {
|
||||
id: 0
|
||||
ticketnumberID[guildId] = {
|
||||
id: 0,
|
||||
};
|
||||
|
||||
fs.writeFileSync(
|
||||
"./Data/TicketData.json",
|
||||
JSON.stringify(ticketnumberID, null, 4),
|
||||
(err) => {
|
||||
if (err) console.log(err);
|
||||
}
|
||||
);
|
||||
|
||||
fs.writeFileSync("./Data/TicketData.json", JSON.stringify(ticketnumberID, null, 4), err => {
|
||||
if (err) console.log(err);
|
||||
});
|
||||
|
||||
return 0;
|
||||
|
||||
|
||||
return 0;
|
||||
} else {
|
||||
return ticketnumberID[guildId].id;
|
||||
return ticketnumberID[guildId].id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static set(guildId, value) {
|
||||
let ticketnumberID = JSON.parse(
|
||||
fs.readFileSync("./Data/TicketData.json", "utf8")
|
||||
);
|
||||
|
||||
static set(guildId, value) {
|
||||
let ticketnumberID = JSON.parse(fs.readFileSync("./Data/TicketData.json", "utf8"));
|
||||
|
||||
ticketnumberID[guildId] = {
|
||||
id: value
|
||||
}
|
||||
id: value,
|
||||
};
|
||||
|
||||
fs.writeFileSync("./Data/TicketData.json", JSON.stringify(ticketnumberID, null, 4), err => {
|
||||
fs.writeFileSync(
|
||||
"./Data/TicketData.json",
|
||||
JSON.stringify(ticketnumberID, null, 4),
|
||||
(err) => {
|
||||
if (err) console.log(err);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
static reset(guildId) {
|
||||
let ticketnumberID = JSON.parse(
|
||||
fs.readFileSync("./Data/TicketData.json", "utf8")
|
||||
);
|
||||
|
||||
static reset(guildId) {
|
||||
let ticketnumberID = JSON.parse(fs.readFileSync("./Data/TicketData.json", "utf8"));
|
||||
|
||||
ticketnumberID[guildId] = {
|
||||
id: 0
|
||||
}
|
||||
id: 0,
|
||||
};
|
||||
|
||||
fs.writeFileSync("./Data/TicketData.json", JSON.stringify(ticketnumberID, null, 4), err => {
|
||||
fs.writeFileSync(
|
||||
"./Data/TicketData.json",
|
||||
JSON.stringify(ticketnumberID, null, 4),
|
||||
(err) => {
|
||||
if (err) console.log(err);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = TicketNumberID;
|
||||
module.exports = TicketNumberID;
|
||||
+18
-18
@@ -4,27 +4,27 @@
|
||||
const fs = require("fs");
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./Data/supportbot.yml', 'utf8'));
|
||||
const cmdconfig = yaml.load(fs.readFileSync('./Data/commands.yml', 'utf8'));
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
|
||||
const cmdconfig = yaml.load(fs.readFileSync("./Data/commands.yml", "utf8"));
|
||||
|
||||
const Command = require("../Structures/Command.js");
|
||||
|
||||
module.exports = new Command({
|
||||
name: cmdconfig.PingCommand,
|
||||
description: cmdconfig.PingCommandDesc,
|
||||
type: "BOTH",
|
||||
slashCommandOptions: [],
|
||||
permission: "SEND_MESSAGES",
|
||||
name: cmdconfig.PingCommand,
|
||||
description: cmdconfig.PingCommandDesc,
|
||||
slashCommandOptions: [],
|
||||
permission: "SEND_MESSAGES",
|
||||
|
||||
async run(message, args, client) {
|
||||
async run(interaction) {
|
||||
const PingEmbed = new Discord.MessageEmbed()
|
||||
.setDescription(
|
||||
`:ping_pong: **Ping:** \`${interaction.client.ws.ping} ms\``
|
||||
)
|
||||
.setColor(supportbot.EmbedColour);
|
||||
|
||||
const PingEmbed = new Discord.MessageEmbed()
|
||||
.setDescription(`:ping_pong: **Ping:** \`${client.ws.ping} ms\``)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
message.channel.send({
|
||||
embeds: [PingEmbed]
|
||||
});
|
||||
}
|
||||
});
|
||||
interaction.reply({
|
||||
embeds: [PingEmbed],
|
||||
});
|
||||
},
|
||||
});
|
||||
+341
-225
@@ -4,242 +4,358 @@
|
||||
const fs = require("fs");
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./Data/supportbot.yml', 'utf8'));
|
||||
const cmdconfig = yaml.load(fs.readFileSync('./Data/commands.yml', 'utf8'));
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
|
||||
const cmdconfig = yaml.load(fs.readFileSync("./Data/commands.yml", "utf8"));
|
||||
|
||||
const Command = require("../Structures/Command.js");
|
||||
const TicketNumberID = require('../Structures/TicketID.js');
|
||||
const TicketNumberID = require("../Structures/TicketID.js");
|
||||
|
||||
async function asyncForEach(array, callback) {
|
||||
for (let index = 0; index < array.length; index++) {
|
||||
await callback(array[index], index, array);
|
||||
}
|
||||
for (let index = 0; index < array.length; index++) {
|
||||
await callback(array[index], index, array);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = new Command({
|
||||
name: cmdconfig.OpenTicket,
|
||||
description: cmdconfig.OpenTicketDesc,
|
||||
type: "BOTH",
|
||||
slashCommandOptions: [],
|
||||
permission: "SEND_MESSAGES",
|
||||
name: cmdconfig.OpenTicket,
|
||||
description: cmdconfig.OpenTicketDesc,
|
||||
slashCommandOptions: [
|
||||
{
|
||||
name: "reason",
|
||||
description: "Ticket Reason",
|
||||
type: "STRING",
|
||||
},
|
||||
],
|
||||
permission: "SEND_MESSAGES",
|
||||
|
||||
async run(message, args, client) {
|
||||
|
||||
let reactionUser = message.guild.members.cache.get(message.author.id)
|
||||
|
||||
if (reactionUser.roles.cache.find(role => role.name === supportbot.TicketBlackListRole) || reactionUser.roles.cache.find(role => role.id === supportbot.TicketBlackListRole)) {
|
||||
return message.channel.send({content:`<@${message.author.id}> ${supportbot.TicketBlackListMessage}`}).then(msg => {
|
||||
setTimeout(() => msg.delete(), 3500)
|
||||
})
|
||||
}
|
||||
|
||||
// Ticket ID
|
||||
let ticketNumberID = TicketNumberID.pad(message.guild.id);
|
||||
|
||||
// Ticket Subject
|
||||
const TicketSubject = args || supportbot.NoTicketSubject;
|
||||
|
||||
const TicketExists = new Discord.MessageEmbed()
|
||||
.setTitle("Ticket Exists!")
|
||||
.setDescription(`${supportbot.TicketExists}`)
|
||||
.setColor(supportbot.WarningColour)
|
||||
|
||||
if (message.guild.channels.cache.find(ticketChannel => ticketChannel.name === `${supportbot.TicketChannel}-${ticketNumberID}`)) {
|
||||
return message.channel.send({ embeds: [TicketExists] });
|
||||
async run(interaction) {
|
||||
let reactionUser = interaction.guild.members.cache.get(interaction.user.id);
|
||||
|
||||
if (
|
||||
reactionUser.roles.cache.find(
|
||||
(role) => role.name === supportbot.TicketBlackListRole
|
||||
) ||
|
||||
reactionUser.roles.cache.find(
|
||||
(role) => role.id === supportbot.TicketBlackListRole
|
||||
)
|
||||
) {
|
||||
return interaction
|
||||
.reply({
|
||||
content: `<@${interaction.user.id}> ${supportbot.TicketBlackListMessage}`,
|
||||
})
|
||||
.then((msg) => {
|
||||
setTimeout(() => msg.delete(), 3500);
|
||||
});
|
||||
}
|
||||
|
||||
// Ticket ID
|
||||
let ticketNumberID = TicketNumberID.pad(interaction.guild.id);
|
||||
|
||||
// Ticket Subject
|
||||
const TicketSubject =
|
||||
interaction.options?.getString("reason") || supportbot.NoTicketSubject;
|
||||
|
||||
const TicketExists = new Discord.MessageEmbed()
|
||||
.setTitle("Ticket Exists!")
|
||||
.setDescription(`${supportbot.TicketExists}`)
|
||||
.setColor(supportbot.WarningColour);
|
||||
|
||||
if (
|
||||
interaction.guild.channels.cache.find(
|
||||
(ticketChannel) =>
|
||||
ticketChannel.name === `${supportbot.TicketChannel}-${ticketNumberID}`
|
||||
)
|
||||
) {
|
||||
return interaction.reply({ embeds: [TicketExists] });
|
||||
}
|
||||
const Staff =
|
||||
interaction.guild.roles.cache.find(
|
||||
(SupportTeam) => SupportTeam.name === supportbot.Staff
|
||||
) ||
|
||||
interaction.guild.roles.cache.find(
|
||||
(SupportTeam) => SupportTeam.id === supportbot.Staff
|
||||
);
|
||||
const Admins =
|
||||
interaction.guild.roles.cache.find(
|
||||
(AdminUser) => AdminUser.name === supportbot.Admin
|
||||
) ||
|
||||
interaction.guild.roles.cache.find(
|
||||
(AdminUser) => AdminUser.id === supportbot.Admin
|
||||
);
|
||||
const DeptRole1 =
|
||||
interaction.guild.roles.cache.find(
|
||||
(DepartmentRole) =>
|
||||
DepartmentRole.name === `${supportbot.DepartmentRole_1}`
|
||||
) ||
|
||||
interaction.guild.roles.cache.find(
|
||||
(DepartmentRole) =>
|
||||
DepartmentRole.id === `${supportbot.DepartmentRole_1}`
|
||||
);
|
||||
const DeptRole2 =
|
||||
interaction.guild.roles.cache.find(
|
||||
(DepartmentRole) =>
|
||||
DepartmentRole.name === `${supportbot.DepartmentRole_2}`
|
||||
) ||
|
||||
interaction.guild.roles.cache.find(
|
||||
(DepartmentRole) =>
|
||||
DepartmentRole.id === `${supportbot.DepartmentRole_2}`
|
||||
);
|
||||
const DeptRole3 =
|
||||
interaction.guild.roles.cache.find(
|
||||
(DepartmentRole) =>
|
||||
DepartmentRole.name === `${supportbot.DepartmentRole_3}`
|
||||
) ||
|
||||
interaction.guild.roles.cache.find(
|
||||
(DepartmentRole) =>
|
||||
DepartmentRole.id === `${supportbot.DepartmentRole_3}`
|
||||
);
|
||||
const Author = interaction.user;
|
||||
const Everyone = interaction.guild.id;
|
||||
const ticketChannel = await interaction.guild.channels.create(
|
||||
`${supportbot.TicketChannel}-${ticketNumberID}`,
|
||||
{
|
||||
type: "GUILD_TEXT",
|
||||
}
|
||||
);
|
||||
|
||||
if (
|
||||
interaction.channel.name === supportbot.ReactionChannel ||
|
||||
interaction.channel.id === supportbot.ReactionChannel
|
||||
) {
|
||||
const CreatedTicket = new Discord.MessageEmbed()
|
||||
.setDescription(
|
||||
supportbot.TicketCreatedAlert.replace(
|
||||
/%ticketauthor%/g,
|
||||
interaction.user.id
|
||||
)
|
||||
.replace(/%ticketid%/g, ticketChannel.id)
|
||||
.replace(/%ticketusername%/g, interaction.user.username)
|
||||
)
|
||||
.setColor(supportbot.EmbedColour);
|
||||
interaction.reply({ embeds: [CreatedTicket], ephemeral: true });
|
||||
} else {
|
||||
const CreatedTicket = new Discord.MessageEmbed()
|
||||
.setDescription(
|
||||
supportbot.TicketCreatedAlert.replace(
|
||||
/%ticketauthor%/g,
|
||||
interaction.user.id
|
||||
)
|
||||
.replace(/%ticketid%/g, ticketChannel.id)
|
||||
.replace(/%ticketusername%/g, interaction.user.username)
|
||||
)
|
||||
.setColor(supportbot.EmbedColour);
|
||||
interaction.reply({ embeds: [CreatedTicket], ephemeral: true });
|
||||
}
|
||||
let AllowArr = [Staff, Staff, Admins, Author];
|
||||
await asyncForEach(AllowArr, (index) => {
|
||||
ticketChannel.permissionOverwrites.create(index, { VIEW_CHANNEL: true });
|
||||
});
|
||||
|
||||
let DenyArr = [Everyone];
|
||||
await asyncForEach(DenyArr, (index) => {
|
||||
ticketChannel.permissionOverwrites.create(index, { VIEW_CHANNEL: false });
|
||||
});
|
||||
|
||||
let TicketCategory =
|
||||
interaction.guild.channels.cache.find(
|
||||
(category) => category.name === supportbot.TicketCategory
|
||||
) ||
|
||||
interaction.guild.channels.cache.find(
|
||||
(category) => category.id === supportbot.TicketCategory
|
||||
);
|
||||
if (TicketCategory) {
|
||||
ticketChannel.setParent(TicketCategory.id);
|
||||
}
|
||||
|
||||
if (supportbot.AllowTicketMentions) {
|
||||
ticketChannel.send({ content: `${interaction.user}` });
|
||||
}
|
||||
|
||||
const TicketMessage = new Discord.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.") {
|
||||
ticketChannel.setTopic(
|
||||
`Reason: ${TicketSubject} - User ID: ${interaction.user.id} - Ticket: ${ticketChannel.name}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (supportbot.TicketDepartments) {
|
||||
TicketMessage.addFields({
|
||||
name: "Departments",
|
||||
value: ` **${supportbot.DepartmentTitle_1}**\n **${supportbot.DepartmentTitle_2}**\n **${supportbot.DepartmentTitle_3}**`,
|
||||
});
|
||||
}
|
||||
const CloseButton = new Discord.MessageButton()
|
||||
.setCustomId("ticketclose")
|
||||
.setLabel("Close")
|
||||
.setStyle(supportbot.TicketCloseColour)
|
||||
.setEmoji(supportbot.TicketCloseEmoji);
|
||||
|
||||
const LockButton = new Discord.MessageButton()
|
||||
.setCustomId("ticketlock")
|
||||
.setLabel("Lock")
|
||||
.setStyle(supportbot.TicketLockColour)
|
||||
.setEmoji(supportbot.TicketLockEmoji);
|
||||
|
||||
const row2 = new Discord.MessageActionRow().addComponents(
|
||||
CloseButton,
|
||||
LockButton
|
||||
);
|
||||
|
||||
if (supportbot.TicketDepartments) {
|
||||
let DenyArr = [DeptRole1, DeptRole2, DeptRole3];
|
||||
await asyncForEach(DenyArr, (index) => {
|
||||
ticketChannel.permissionOverwrites.create(index, {
|
||||
VIEW_CHANNEL: false,
|
||||
});
|
||||
});
|
||||
const Department1Button = new Discord.MessageButton()
|
||||
.setCustomId("Department1")
|
||||
.setLabel(`${supportbot.DepartmentTitle_1}`)
|
||||
.setStyle(supportbot.TicketDept1Colour)
|
||||
.setEmoji(supportbot.TicketDept1Emoji);
|
||||
|
||||
const Department2Button = new Discord.MessageButton()
|
||||
.setCustomId("Department2")
|
||||
.setLabel(`${supportbot.DepartmentTitle_2}`)
|
||||
.setStyle(supportbot.TicketDept2Colour)
|
||||
.setEmoji(supportbot.TicketDept2Emoji);
|
||||
|
||||
const Department3Button = new Discord.MessageButton()
|
||||
.setCustomId("Department3")
|
||||
.setLabel(`${supportbot.DepartmentTitle_3}`)
|
||||
.setStyle(supportbot.TicketDept3Colour)
|
||||
.setEmoji(supportbot.TicketDept3Emoji);
|
||||
|
||||
const row = new Discord.MessageActionRow().addComponents(
|
||||
Department1Button,
|
||||
Department2Button,
|
||||
Department3Button
|
||||
);
|
||||
|
||||
const m = await ticketChannel.send({
|
||||
embeds: [TicketMessage],
|
||||
components: [row],
|
||||
});
|
||||
|
||||
const filter = (i) => {
|
||||
i.deferUpdate();
|
||||
return i.user.id === interaction.user.id;
|
||||
};
|
||||
const collector = m.createMessageComponentCollector({
|
||||
filter,
|
||||
max: 1,
|
||||
componentType: "BUTTON",
|
||||
time: 60000,
|
||||
});
|
||||
|
||||
collector.on("collect", async (i) => {
|
||||
if (i.customId === "Department1") {
|
||||
ticketChannel.permissionOverwrites.edit(DeptRole1, {
|
||||
VIEW_CHANNEL: true,
|
||||
READ_MESSAGE_HISTORY: true,
|
||||
SEND_MESSAGES: true,
|
||||
});
|
||||
|
||||
if (!supportbot.AllowStaff) {
|
||||
ticketChannel.permissionOverwrites.edit(Staff, {
|
||||
VIEW_CHANNEL: false,
|
||||
READ_MESSAGE_HISTORY: false,
|
||||
SEND_MESSAGES: false,
|
||||
});
|
||||
}
|
||||
const Staff = message.guild.roles.cache.find(SupportTeam => SupportTeam.name === supportbot.Staff) || message.guild.roles.cache.find(SupportTeam => SupportTeam.id === supportbot.Staff)
|
||||
const Admins = message.guild.roles.cache.find(AdminUser => AdminUser.name === supportbot.Admin) || message.guild.roles.cache.find(AdminUser => AdminUser.id === supportbot.Admin)
|
||||
const DeptRole1 = message.guild.roles.cache.find(DepartmentRole => DepartmentRole.name === `${supportbot.DepartmentRole_1}`) || message.guild.roles.cache.find(DepartmentRole => DepartmentRole.id === `${supportbot.DepartmentRole_1}`)
|
||||
const DeptRole2 = message.guild.roles.cache.find(DepartmentRole => DepartmentRole.name === `${supportbot.DepartmentRole_2}`) || message.guild.roles.cache.find(DepartmentRole => DepartmentRole.id === `${supportbot.DepartmentRole_2}`)
|
||||
const DeptRole3 = message.guild.roles.cache.find(DepartmentRole => DepartmentRole.name === `${supportbot.DepartmentRole_3}`) || message.guild.roles.cache.find(DepartmentRole => DepartmentRole.id === `${supportbot.DepartmentRole_3}`)
|
||||
const Author = message.author
|
||||
const Everyone = message.guild.id
|
||||
const ticketChannel = await message.guild.channels.create(`${supportbot.TicketChannel}-${ticketNumberID}`, {
|
||||
type: "GUILD_TEXT",
|
||||
})
|
||||
|
||||
if (message.channel.name === supportbot.ReactionChannel || message.channel.id === supportbot.ReactionChannel) {
|
||||
const CreatedTicket = new Discord.MessageEmbed()
|
||||
.setDescription(supportbot.TicketCreatedAlert.replace(/%ticketauthor%/g, message.author.id).replace(/%ticketid%/g, ticketChannel.id).replace(/%ticketusername%/g, message.author.username))
|
||||
.setColor(supportbot.EmbedColour)
|
||||
message.channel.send({embeds: [CreatedTicket]}).then(msg => {
|
||||
setTimeout(() => msg.delete(), 5000)
|
||||
})
|
||||
} else {
|
||||
const CreatedTicket = new Discord.MessageEmbed()
|
||||
.setDescription(supportbot.TicketCreatedAlert.replace(/%ticketauthor%/g, message.author.id).replace(/%ticketid%/g, ticketChannel.id).replace(/%ticketusername%/g, message.author.username))
|
||||
.setColor(supportbot.EmbedColour)
|
||||
message.channel.send({embeds: [CreatedTicket]}).then(msg => setTimeout(() => msg.delete(), 5000));
|
||||
}
|
||||
let AllowArr = [Staff, Staff, Admins, Author]
|
||||
await asyncForEach(AllowArr, (index) => {
|
||||
ticketChannel.permissionOverwrites.create(index, {VIEW_CHANNEL: true})
|
||||
})
|
||||
|
||||
let DenyArr = [Everyone]
|
||||
await asyncForEach(DenyArr, (index) => {
|
||||
ticketChannel.permissionOverwrites.create(index, {VIEW_CHANNEL: false})
|
||||
})
|
||||
|
||||
let TicketCategory = message.guild.channels.cache.find(category => category.name === supportbot.TicketCategory) || message.guild.channels.cache.find(category => category.id === supportbot.TicketCategory)
|
||||
if(TicketCategory) {
|
||||
ticketChannel.setParent(TicketCategory.id)
|
||||
}
|
||||
|
||||
|
||||
const Department1 = new Discord.MessageEmbed()
|
||||
.setDescription(
|
||||
`> Thank for reaching out to the **${supportbot.DepartmentTitle_1} Department**. Please provide us information regarding your query.`
|
||||
)
|
||||
.setColor(supportbot.EmbedColour);
|
||||
ticketChannel.send({ embeds: [Department1] });
|
||||
|
||||
if (supportbot.AllowTicketMentions) {
|
||||
ticketChannel.send({content:`${message.author}`})
|
||||
ticketChannel.send({ content: `@here` });
|
||||
}
|
||||
|
||||
const TicketMessage = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.Ticket_Title.replace(/%ticketauthor%/g, message.author.id).replace(/%ticketid%/g, ticketChannel.id).replace(/%ticketusername%/g, message.author.username))
|
||||
.setDescription(supportbot.TicketMessage.replace(/%ticketauthor%/g, message.author.id).replace(/%ticketid%/g, ticketChannel.id).replace(/%ticketusername%/g, message.author.username))
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
if (supportbot.TicketSubject === "embed") {
|
||||
|
||||
if (TicketSubject != 'No Reason Provided.') {
|
||||
TicketMessage.addFields({ name: 'Reason', value: TicketSubject })
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (supportbot.TicketSubject === "description") {
|
||||
|
||||
if (TicketSubject != 'No Reason Provided.') {
|
||||
ticketChannel.setTopic(`Reason: ${TicketSubject} - User ID: ${message.author.id} - Ticket: ${ticketChannel.name}`)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (supportbot.TicketDepartments) {
|
||||
TicketMessage.addFields({ name: 'Departments', value: ` **${supportbot.DepartmentTitle_1}**\n **${supportbot.DepartmentTitle_2}**\n **${supportbot.DepartmentTitle_3}**` })
|
||||
}
|
||||
const CloseButton = new Discord.MessageButton()
|
||||
.setCustomId('ticketclose')
|
||||
.setLabel('Close')
|
||||
.setStyle(supportbot.TicketCloseColour)
|
||||
.setEmoji(supportbot.TicketCloseEmoji)
|
||||
|
||||
const LockButton = new Discord.MessageButton()
|
||||
.setCustomId('ticketlock')
|
||||
.setLabel('Lock')
|
||||
.setStyle(supportbot.TicketLockColour)
|
||||
.setEmoji(supportbot.TicketLockEmoji)
|
||||
|
||||
const row2 = new Discord.MessageActionRow()
|
||||
.addComponents(CloseButton, LockButton)
|
||||
|
||||
if(supportbot.TicketDepartments) {
|
||||
|
||||
let DenyArr = [DeptRole1, DeptRole2, DeptRole3]
|
||||
await asyncForEach(DenyArr, (index) => {
|
||||
ticketChannel.permissionOverwrites.create(index, {VIEW_CHANNEL: false})
|
||||
})
|
||||
const Department1Button = new Discord.MessageButton()
|
||||
.setCustomId('Department1')
|
||||
.setLabel(`${supportbot.DepartmentTitle_1}`)
|
||||
.setStyle(supportbot.TicketDept1Colour)
|
||||
.setEmoji(supportbot.TicketDept1Emoji)
|
||||
|
||||
const Department2Button = new Discord.MessageButton()
|
||||
.setCustomId('Department2')
|
||||
.setLabel(`${supportbot.DepartmentTitle_2}`)
|
||||
.setStyle(supportbot.TicketDept2Colour)
|
||||
.setEmoji(supportbot.TicketDept2Emoji)
|
||||
|
||||
const Department3Button = new Discord.MessageButton()
|
||||
.setCustomId('Department3')
|
||||
.setLabel(`${supportbot.DepartmentTitle_3}`)
|
||||
.setStyle(supportbot.TicketDept3Colour)
|
||||
.setEmoji(supportbot.TicketDept3Emoji)
|
||||
|
||||
const row = new Discord.MessageActionRow()
|
||||
.addComponents(Department1Button, Department2Button, Department3Button)
|
||||
|
||||
const m = await ticketChannel.send({embeds: [TicketMessage], components: [row]})
|
||||
|
||||
const filter = i => {
|
||||
i.deferUpdate();
|
||||
return i.user.id === message.author.id;
|
||||
};
|
||||
const collector = m.createMessageComponentCollector({ filter, max: 1, componentType: 'BUTTON', time: 60000 });
|
||||
|
||||
collector.on('collect',async (i) => {
|
||||
|
||||
if(i.customId === 'Department1') {
|
||||
|
||||
ticketChannel.permissionOverwrites.edit(DeptRole1, {
|
||||
VIEW_CHANNEL: true,
|
||||
READ_MESSAGE_HISTORY: true,
|
||||
SEND_MESSAGES: true,
|
||||
})
|
||||
|
||||
if(!supportbot.AllowStaff) {
|
||||
ticketChannel.permissionOverwrites.edit(Staff, { VIEW_CHANNEL: false, READ_MESSAGE_HISTORY: false, SEND_MESSAGES: false })
|
||||
}
|
||||
|
||||
const Department1 = new Discord.MessageEmbed()
|
||||
.setDescription(`> Thank for reaching out to the **${supportbot.DepartmentTitle_1} Department**. Please provide us information regarding your query.`)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
ticketChannel.send({ embeds: [Department1] });
|
||||
|
||||
if (supportbot.AllowTicketMentions) {
|
||||
ticketChannel.send({content: `@here`})
|
||||
}
|
||||
}
|
||||
i.message.edit({embeds: [TicketMessage], components: [row2]})
|
||||
|
||||
if(i.customId === 'Department2') {
|
||||
|
||||
ticketChannel.permissionOverwrites.edit(DeptRole2, {
|
||||
VIEW_CHANNEL: true,
|
||||
READ_MESSAGE_HISTORY: true,
|
||||
SEND_MESSAGES: true,
|
||||
})
|
||||
|
||||
if(!supportbot.AllowStaff) {
|
||||
ticketChannel.permissionOverwrites.edit(Staff, { VIEW_CHANNEL: false, READ_MESSAGE_HISTORY: false, SEND_MESSAGES: false })
|
||||
}
|
||||
|
||||
|
||||
const Department2 = new Discord.MessageEmbed()
|
||||
.setDescription(`> Thank for reaching out to the **${supportbot.DepartmentTitle_2} Department**. Please provide us information regarding your query.`)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
ticketChannel.send({ embeds: [Department2] });
|
||||
|
||||
if (supportbot.AllowTicketMentions) {
|
||||
ticketChannel.send({content: `@here`})
|
||||
}
|
||||
|
||||
i.message.edit({embeds: [TicketMessage], components: [row2]})
|
||||
}
|
||||
if(i.customId === 'Department3') {
|
||||
|
||||
ticketChannel.permissionOverwrites.edit(DeptRole3, {
|
||||
VIEW_CHANNEL: true,
|
||||
READ_MESSAGE_HISTORY: true,
|
||||
SEND_MESSAGES: true,
|
||||
})
|
||||
|
||||
if(!supportbot.AllowStaff) {
|
||||
ticketChannel.permissionOverwrites.edit(Staff, { VIEW_CHANNEL: false, READ_MESSAGE_HISTORY: false, SEND_MESSAGES: false })
|
||||
}
|
||||
|
||||
const Department3 = new Discord.MessageEmbed()
|
||||
.setDescription(`> Thank for reaching out to the **${supportbot.DepartmentTitle_3} Department**. Please provide us information regarding your query.`)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
ticketChannel.send({ embeds: [Department3] });
|
||||
|
||||
if (supportbot.AllowTicketMentions) {
|
||||
ticketChannel.send({content: `@here`})
|
||||
}
|
||||
i.message.edit({embeds: [TicketMessage], components: [row2]})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
ticketChannel.send({embeds: [TicketMessage], components: [row2]})
|
||||
}
|
||||
i.message.edit({ embeds: [TicketMessage], components: [row2] });
|
||||
|
||||
if (i.customId === "Department2") {
|
||||
ticketChannel.permissionOverwrites.edit(DeptRole2, {
|
||||
VIEW_CHANNEL: true,
|
||||
READ_MESSAGE_HISTORY: true,
|
||||
SEND_MESSAGES: true,
|
||||
});
|
||||
|
||||
if (!supportbot.AllowStaff) {
|
||||
ticketChannel.permissionOverwrites.edit(Staff, {
|
||||
VIEW_CHANNEL: false,
|
||||
READ_MESSAGE_HISTORY: false,
|
||||
SEND_MESSAGES: false,
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
const Department2 = new Discord.MessageEmbed()
|
||||
.setDescription(
|
||||
`> Thank for reaching out to the **${supportbot.DepartmentTitle_2} Department**. Please provide us information regarding your query.`
|
||||
)
|
||||
.setColor(supportbot.EmbedColour);
|
||||
ticketChannel.send({ embeds: [Department2] });
|
||||
|
||||
if (supportbot.AllowTicketMentions) {
|
||||
ticketChannel.send({ content: `@here` });
|
||||
}
|
||||
|
||||
i.message.edit({ embeds: [TicketMessage], components: [row2] });
|
||||
}
|
||||
if (i.customId === "Department3") {
|
||||
ticketChannel.permissionOverwrites.edit(DeptRole3, {
|
||||
VIEW_CHANNEL: true,
|
||||
READ_MESSAGE_HISTORY: true,
|
||||
SEND_MESSAGES: true,
|
||||
});
|
||||
|
||||
if (!supportbot.AllowStaff) {
|
||||
ticketChannel.permissionOverwrites.edit(Staff, {
|
||||
VIEW_CHANNEL: false,
|
||||
READ_MESSAGE_HISTORY: false,
|
||||
SEND_MESSAGES: false,
|
||||
});
|
||||
}
|
||||
|
||||
const Department3 = new Discord.MessageEmbed()
|
||||
.setDescription(
|
||||
`> Thank for reaching out to the **${supportbot.DepartmentTitle_3} Department**. Please provide us information regarding your query.`
|
||||
)
|
||||
.setColor(supportbot.EmbedColour);
|
||||
ticketChannel.send({ embeds: [Department3] });
|
||||
|
||||
if (supportbot.AllowTicketMentions) {
|
||||
ticketChannel.send({ content: `@here` });
|
||||
}
|
||||
i.message.edit({ embeds: [TicketMessage], components: [row2] });
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ticketChannel.send({ embeds: [TicketMessage], components: [row2] });
|
||||
}
|
||||
},
|
||||
});
|
||||
+157
-143
@@ -4,163 +4,177 @@
|
||||
const fs = require("fs");
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./Data/supportbot.yml', 'utf8'));
|
||||
const cmdconfig = yaml.load(fs.readFileSync('./Data/commands.yml', 'utf8'));
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
|
||||
const cmdconfig = yaml.load(fs.readFileSync("./Data/commands.yml", "utf8"));
|
||||
|
||||
const Event = require("../Structures/Event.js");
|
||||
|
||||
module.exports = new Event("interactionCreate", (client, interaction) => {
|
||||
|
||||
if (interaction.isCommand()) return;
|
||||
|
||||
const command = client.commands.find(cmd => cmd.name.toLowerCase() == interaction.commandName);
|
||||
if (interaction.isCommand()) {
|
||||
const command = client.commands.find(
|
||||
(cmd) => cmd.name.toLowerCase() == interaction.commandName
|
||||
);
|
||||
|
||||
if (interaction.user.bot || !interaction.isCommand() || !interaction.guild)
|
||||
return;
|
||||
|
||||
const args = [
|
||||
interaction.commandName,
|
||||
...client.commands
|
||||
.find(cmd => cmd.name.toLowerCase() == interaction.commandName)
|
||||
.slashCommandOptions.map(v => `${interaction.options.get(v.name).value}`)
|
||||
];
|
||||
return;
|
||||
|
||||
const NotValid = new Discord.MessageEmbed()
|
||||
.setDescription(`:x: \`Invalid Command\` `)
|
||||
.setColor(supportbot.ErrorColour)
|
||||
.setDescription(`:x: \`Invalid Command\` `)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
|
||||
if (!command) return interaction.reply({
|
||||
embeds: [NotValid]
|
||||
});
|
||||
if (!command)
|
||||
return interaction.reply({
|
||||
embeds: [NotValid],
|
||||
});
|
||||
|
||||
const permission = interaction.member.permissions.has(command.permission);
|
||||
|
||||
const ValidPerms = new Discord.MessageEmbed()
|
||||
.setDescription(":x: \`Invalid Permissions\` Do you have the correct permissions to execute this command?")
|
||||
.setColor(supportbot.ErrorColour)
|
||||
.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, args, client);
|
||||
|
||||
if(interaction.isButton()) {
|
||||
if(interaction.customId === 'openticket') {
|
||||
interaction.message.fetch()
|
||||
interaction.deferUpdate()
|
||||
let message = {
|
||||
guild: client.guilds.cache.get(interaction.message.guildId),
|
||||
author: client.users.cache.get(interaction.user.id),
|
||||
content: "N/A",
|
||||
channel: client.channels.cache.get(interaction.message.channelId)
|
||||
}
|
||||
try {
|
||||
const cmd = client.commands.get(cmdconfig.OpenTicket);
|
||||
if(!cmd) return;
|
||||
cmd.run(message, message.content)
|
||||
}
|
||||
catch (error){
|
||||
console.error(error)
|
||||
}
|
||||
}
|
||||
|
||||
if(interaction.customId === 'ticketclose') {
|
||||
if(interaction.channel.name.startsWith(`${supportbot.TicketChannel}-`)) {
|
||||
interaction.message.fetch()
|
||||
interaction.deferUpdate()
|
||||
const DeleteTicketEmbed = new Discord.MessageEmbed()
|
||||
.setDescription(supportbot.TicketDeleteMessage)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
interaction.channel.send({embeds: [DeleteTicketEmbed]})
|
||||
|
||||
let logChannel = interaction.guild.channels.cache.find(channel => channel.name === supportbot.TranscriptLog) || interaction.guild.channels.cache.find(channel => channel.id === supportbot.TranscriptLog)
|
||||
|
||||
let user = interaction.user
|
||||
let name = interaction.channel.name;
|
||||
let ticketChannel = interaction.channel
|
||||
let reason = "No Reason Provided."
|
||||
|
||||
interaction.channel.send({content: `**${supportbot.ClosingTicket}**`})
|
||||
.then(() => {
|
||||
const logEmbed = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.TranscriptTitle)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter(supportbot.EmbedFooter)
|
||||
.addField("Closed By", user.username)
|
||||
.addField("Reason", reason)
|
||||
|
||||
interaction.channel.messages.fetch({limit: 100}).then(msgs => {
|
||||
let html = ''
|
||||
|
||||
msgs = msgs.sort( ( a, b ) => a.createdTimestamp - b.createdTimestamp );
|
||||
html += `<strong>Server Name:</strong> ${interaction.guild.name}<br>`
|
||||
html += `<strong>Ticket:</strong> ${ticketChannel.name}<br>`
|
||||
html += `<strong>Message:</strong> ${msgs.size} Messages<br><br><br>`
|
||||
|
||||
|
||||
msgs.forEach(msg => {
|
||||
if(msg.content) {
|
||||
html += `<strong>User:</strong> ${msg.author.tag}<br>`;
|
||||
html += `<strong>Message:</strong> ${msg.content}<br>`;
|
||||
html += `-----<br><br>`;
|
||||
}
|
||||
})
|
||||
|
||||
const TranscriptSavedEmbed = new Discord.MessageEmbed()
|
||||
.setDescription(supportbot.TranscriptSavedMessage)
|
||||
.setColor(supportbot.SuccessColour)
|
||||
interaction.channel.send({embeds: [TranscriptSavedEmbed]})
|
||||
|
||||
let file = new Discord.MessageAttachment( Buffer.from( html ), `${name}.html` )
|
||||
logChannel.send({embeds: [logEmbed], files: [file]})
|
||||
|
||||
setTimeout(() => interaction.channel.delete(), supportbot.TicketDeleteTime)
|
||||
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
if(interaction.customId === 'ticketlock') {
|
||||
if(interaction.channel.name.startsWith(`${supportbot.TicketChannel}`)) {
|
||||
interaction.message.fetch()
|
||||
interaction.deferUpdate()
|
||||
let Admin = interaction.guild.roles.cache.find(AdminUser => AdminUser.name === supportbot.Admin) || interaction.guild.roles.cache.find(AdminUser => AdminUser.id === supportbot.Admin)
|
||||
let all = interaction.channel.permissionOverwrites.cache
|
||||
|
||||
let parent = interaction.guild.channels.cache.find(c => c.name === `${supportbot.LockTicketCategory}`) || interaction.guild.channels.cache.find(c => c.id === `${supportbot.LockTicketCategory}`)
|
||||
if(parent) {
|
||||
interaction.channel.setParent(parent.id)
|
||||
}
|
||||
|
||||
all.forEach(perm => {
|
||||
interaction.channel.permissionOverwrites.delete(perm.id)
|
||||
|
||||
})
|
||||
interaction.channel.permissionOverwrites.create(Admin.id, {VIEW_CHANNEL: true})
|
||||
|
||||
interaction.channel.permissionOverwrites.create(interaction.guild.id, {VIEW_CHANNEL: false})
|
||||
|
||||
|
||||
const ticketDeleteButton = new 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.channel.send({embeds: [ArchiveEmbed]})
|
||||
interaction.message.edit({components: [row]})
|
||||
}
|
||||
}
|
||||
return interaction.reply({
|
||||
embeds: [ValidPerms],
|
||||
});
|
||||
interaction.user = interaction.user;
|
||||
command.run(interaction);
|
||||
}
|
||||
if (interaction.isButton()) {
|
||||
if (interaction.customId === "openticket") {
|
||||
try {
|
||||
const cmd = client.commands.get(cmdconfig.OpenTicket);
|
||||
if (!cmd) return;
|
||||
cmd.run(interaction);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
if (interaction.customId === "ticketclose") {
|
||||
if (interaction.channel.name.startsWith(`${supportbot.TicketChannel}-`)) {
|
||||
interaction.message.fetch();
|
||||
interaction.deferUpdate();
|
||||
const DeleteTicketEmbed = new Discord.MessageEmbed()
|
||||
.setDescription(supportbot.TicketDeleteMessage)
|
||||
.setColor(supportbot.EmbedColour);
|
||||
interaction.channel.send({ embeds: [DeleteTicketEmbed] });
|
||||
|
||||
let logChannel =
|
||||
interaction.guild.channels.cache.find(
|
||||
(channel) => channel.name === supportbot.TranscriptLog
|
||||
) ||
|
||||
interaction.guild.channels.cache.find(
|
||||
(channel) => channel.id === supportbot.TranscriptLog
|
||||
);
|
||||
|
||||
let user = interaction.user;
|
||||
let name = interaction.channel.name;
|
||||
let ticketChannel = interaction.channel;
|
||||
let reason = "No Reason Provided.";
|
||||
|
||||
interaction.channel
|
||||
.send({ content: `**${supportbot.ClosingTicket}**` })
|
||||
.then(() => {
|
||||
const logEmbed = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.TranscriptTitle)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter(supportbot.EmbedFooter)
|
||||
.addField("Closed By", user.username)
|
||||
.addField("Reason", reason);
|
||||
|
||||
interaction.channel.messages.fetch({ limit: 100 }).then((msgs) => {
|
||||
let html = "";
|
||||
|
||||
msgs = msgs.sort(
|
||||
(a, b) => a.createdTimestamp - b.createdTimestamp
|
||||
);
|
||||
html += `<strong>Server Name:</strong> ${interaction.guild.name}<br>`;
|
||||
html += `<strong>Ticket:</strong> ${ticketChannel.name}<br>`;
|
||||
html += `<strong>Message:</strong> ${msgs.size} Messages<br><br><br>`;
|
||||
|
||||
msgs.forEach((msg) => {
|
||||
if (msg.content) {
|
||||
html += `<strong>User:</strong> ${msg.author.tag}<br>`;
|
||||
html += `<strong>Message:</strong> ${msg.content}<br>`;
|
||||
html += `-----<br><br>`;
|
||||
}
|
||||
});
|
||||
|
||||
const TranscriptSavedEmbed = new Discord.MessageEmbed()
|
||||
.setDescription(supportbot.TranscriptSavedMessage)
|
||||
.setColor(supportbot.SuccessColour);
|
||||
interaction.channel.send({ embeds: [TranscriptSavedEmbed] });
|
||||
|
||||
let file = new Discord.MessageAttachment(
|
||||
Buffer.from(html),
|
||||
`${name}.html`
|
||||
);
|
||||
logChannel.send({ embeds: [logEmbed], files: [file] });
|
||||
|
||||
setTimeout(
|
||||
() => interaction.channel.delete(),
|
||||
supportbot.TicketDeleteTime
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
if (interaction.customId === "ticketlock") {
|
||||
if (interaction.channel.name.startsWith(`${supportbot.TicketChannel}`)) {
|
||||
interaction.message.fetch();
|
||||
interaction.deferUpdate();
|
||||
let Admin =
|
||||
interaction.guild.roles.cache.find(
|
||||
(AdminUser) => AdminUser.name === supportbot.Admin
|
||||
) ||
|
||||
interaction.guild.roles.cache.find(
|
||||
(AdminUser) => AdminUser.id === supportbot.Admin
|
||||
);
|
||||
let all = interaction.channel.permissionOverwrites.cache;
|
||||
|
||||
let parent =
|
||||
interaction.guild.channels.cache.find(
|
||||
(c) => c.name === `${supportbot.LockTicketCategory}`
|
||||
) ||
|
||||
interaction.guild.channels.cache.find(
|
||||
(c) => c.id === `${supportbot.LockTicketCategory}`
|
||||
);
|
||||
if (parent) {
|
||||
interaction.channel.setParent(parent.id);
|
||||
}
|
||||
|
||||
all.forEach((perm) => {
|
||||
interaction.channel.permissionOverwrites.delete(perm.id);
|
||||
});
|
||||
interaction.channel.permissionOverwrites.create(Admin.id, {
|
||||
VIEW_CHANNEL: true,
|
||||
});
|
||||
|
||||
interaction.channel.permissionOverwrites.create(interaction.guild.id, {
|
||||
VIEW_CHANNEL: false,
|
||||
});
|
||||
|
||||
const ticketDeleteButton = new 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.channel.send({ embeds: [ArchiveEmbed] });
|
||||
interaction.message.edit({ components: [row] });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1,50 +0,0 @@
|
||||
// SupportBot | Emerald Services
|
||||
// Message Create Event
|
||||
|
||||
const fs = require("fs");
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./Data/supportbot.yml', 'utf8'));
|
||||
|
||||
const Event = require("../Structures/Event.js");
|
||||
|
||||
module.exports = new Event("messageCreate", (client, message) => {
|
||||
if (message.author.bot) return;
|
||||
|
||||
if (!message.content.startsWith(client.prefix)) return;
|
||||
|
||||
const args = message.content.substring(client.prefix.length).split(/ +/);
|
||||
|
||||
const command = client.commands.find(cmd => cmd.name == args[0]);
|
||||
|
||||
const NotValid = new Discord.MessageEmbed()
|
||||
.setDescription(`:x: \`${args[0]}\` is an Invalid Command `)
|
||||
.setColor(supportbot.ErrorColour)
|
||||
|
||||
if (!command) return message.reply({
|
||||
embeds: [NotValid]
|
||||
});
|
||||
|
||||
const OnlySlashCmd = new Discord.MessageEmbed()
|
||||
.setDescription(`:warning: That command is only useable as a \`Slash Command\` `)
|
||||
.setColor(supportbot.WarnColour)
|
||||
|
||||
if (!["BOTH", "TEXT"].includes(command.type))
|
||||
return message.reply({
|
||||
embeds: [OnlySlashCmd]
|
||||
})
|
||||
|
||||
const permission = message.member.permissions.has(command.permission, true);
|
||||
|
||||
const ValidPerms = new Discord.MessageEmbed()
|
||||
.setDescription(":x: Do you have the \`${command.permission}\` permissions to execute this command?")
|
||||
.setColor(supportbot.ErrorColour)
|
||||
|
||||
if (!permission)
|
||||
return message.reply(
|
||||
`You do not have the permission \`${command.permission}\` to run this command!`
|
||||
);
|
||||
|
||||
command.run(message, args, client);
|
||||
});
|
||||
+112
-79
@@ -4,90 +4,123 @@
|
||||
const fs = require("fs");
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./Data/supportbot.yml', 'utf8'));
|
||||
const panelconfig = yaml.load(fs.readFileSync('./Data/ticket-panel.yml', 'utf8'));
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
|
||||
const panelconfig = yaml.load(
|
||||
fs.readFileSync("./Data/ticket-panel.yml", "utf8")
|
||||
);
|
||||
|
||||
const Event = require("../Structures/Event.js");
|
||||
|
||||
module.exports = new Event("ready", client => {
|
||||
client.user.setActivity(supportbot.BotActivity, {
|
||||
type: supportbot.ActivityType,
|
||||
url: supportbot.StreamingURL
|
||||
});
|
||||
module.exports = new Event("ready", (client) => {
|
||||
client.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.Name} v${supportbot.SupportBot_Version}`, `\u001b[36m`, `Connected to Discord`)
|
||||
console.log(`\u001b[33m`, `Resources:`, `\u001b[36m`, `https://emeraldsrv.dev/resources`)
|
||||
console.log(`\u001b[33m`, `Documentation:`, `\u001b[36m`, `https://supportbot.emeraldsrv.dev`)
|
||||
console.log(`\u001b[33m`, `Discord:`, `\u001b[36m`, `https://emeraldsrv.dev/discord`)
|
||||
console.log(`\u001b[33m`, `Hosting:`, `\u001b[36m`, `https://emeraldsrv.dev/hosting`)
|
||||
console.log(` `)
|
||||
console.log(`\u001b[37m`, `SupportBot proudly created by Emerald Services`)
|
||||
console.log(` `)
|
||||
console.log(`\u001b[31m`, `――――――――――――――――――――――――――――――――――――――――――――`)
|
||||
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.Name} v${supportbot.SupportBot_Version}`,
|
||||
`\u001b[36m`,
|
||||
`Connected to Discord`
|
||||
);
|
||||
console.log(
|
||||
`\u001b[33m`,
|
||||
`Resources:`,
|
||||
`\u001b[36m`,
|
||||
`https://emeraldsrv.dev/resources`
|
||||
);
|
||||
console.log(
|
||||
`\u001b[33m`,
|
||||
`Documentation:`,
|
||||
`\u001b[36m`,
|
||||
`https://supportbot.emeraldsrv.dev`
|
||||
);
|
||||
console.log(
|
||||
`\u001b[33m`,
|
||||
`Discord:`,
|
||||
`\u001b[36m`,
|
||||
`https://emeraldsrv.dev/discord`
|
||||
);
|
||||
console.log(
|
||||
`\u001b[33m`,
|
||||
`Hosting:`,
|
||||
`\u001b[36m`,
|
||||
`https://emeraldsrv.dev/hosting`
|
||||
);
|
||||
console.log(` `);
|
||||
console.log(`\u001b[37m`, `SupportBot proudly created by Emerald Services`);
|
||||
console.log(` `);
|
||||
console.log(`\u001b[31m`, `――――――――――――――――――――――――――――――――――――――――――――`);
|
||||
|
||||
if (panelconfig.TicketPanel) {
|
||||
let chan1 = client.channels.cache.find(channel => channel.name === panelconfig.Channel)
|
||||
if (panelconfig.TicketPanel) {
|
||||
let chan1 = client.channels.cache.find(
|
||||
(channel) => channel.name === panelconfig.Channel
|
||||
);
|
||||
|
||||
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 = yaml.load(fs.readFileSync('./Data/ticket-panel-id.yml', 'utf8'));
|
||||
|
||||
chan1.messages.fetch(panelid.TicketPanelID).catch(async r => {
|
||||
let embed = new Discord.MessageEmbed()
|
||||
.setTitle(`${panelconfig.PanelTitle}`)
|
||||
.setColor(supportbot.SuccessColour)
|
||||
.setFooter(supportbot.EmbedFooter);
|
||||
|
||||
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 = new Discord.MessageButton()
|
||||
.setLabel(panelconfig.ButtonLabel)
|
||||
.setCustomId('openticket')
|
||||
.setStyle(panelconfig.ButtonColour)
|
||||
|
||||
let row = new Discord.MessageActionRow()
|
||||
.addComponents(button)
|
||||
|
||||
|
||||
await chan1.send({
|
||||
embeds: [embed],
|
||||
components: [row]
|
||||
}).then(r => {
|
||||
let data = {
|
||||
"TicketPanelID": `${r.id}`
|
||||
}
|
||||
let yamlStr = yaml.dump(data);
|
||||
fs.writeFileSync('./Data/ticket-panel-id.yml', yamlStr, 'utf8');
|
||||
|
||||
}).catch(e => {
|
||||
console.log("Raw"+e)
|
||||
})
|
||||
})
|
||||
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 = yaml.load(
|
||||
fs.readFileSync("./Data/ticket-panel-id.yml", "utf8")
|
||||
);
|
||||
|
||||
chan1.messages.fetch(panelid.TicketPanelID).catch(async (r) => {
|
||||
let embed = new Discord.MessageEmbed()
|
||||
.setTitle(`${panelconfig.PanelTitle}`)
|
||||
.setColor(supportbot.SuccessColour)
|
||||
.setFooter(supportbot.EmbedFooter);
|
||||
|
||||
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 = new Discord.MessageButton()
|
||||
.setLabel(panelconfig.ButtonLabel)
|
||||
.setCustomId("openticket")
|
||||
.setStyle(panelconfig.ButtonColour);
|
||||
|
||||
let row = new Discord.MessageActionRow().addComponents(button);
|
||||
|
||||
await chan1
|
||||
.send({
|
||||
embeds: [embed],
|
||||
components: [row],
|
||||
})
|
||||
.then((r) => {
|
||||
let data = {
|
||||
TicketPanelID: `${r.id}`,
|
||||
};
|
||||
let yamlStr = yaml.dump(data);
|
||||
fs.writeFileSync("./Data/ticket-panel-id.yml", yamlStr, "utf8");
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log("Raw" + e);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -1,8 +1,8 @@
|
||||
// ___ _ ___ _
|
||||
// / __> _ _ ___ ___ ___ _ _ _| |_ | . > ___ _| |_
|
||||
// \__ \| | || . \| . \/ . \| '_> | | | . \/ . \ | |
|
||||
// <___/`___|| _/| _/\___/|_| |_| |___/\___/ |_|
|
||||
// |_| |_|
|
||||
// ___ _ ___ _
|
||||
// / __> _ _ ___ ___ ___ _ _ _| |_ | . > ___ _| |_
|
||||
// \__ \| | || . \| . \/ . \| '_> | | | . \/ . \ | |
|
||||
// <___/`___|| _/| _/\___/|_| |_| |___/\___/ |_|
|
||||
// |_| |_|
|
||||
//
|
||||
// SupportBot created by Emerald Services
|
||||
// Installed with MIT License
|
||||
@@ -13,12 +13,10 @@
|
||||
const fs = require("fs");
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./Data/supportbot.yml', 'utf8'));
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(fs.readFileSync("./Data/supportbot.yml", "utf8"));
|
||||
|
||||
const Client = require("./Structures/Client.js");
|
||||
const client = new Client({});
|
||||
|
||||
client.start(supportbot.Token);
|
||||
|
||||
|
||||
+7
-7
@@ -1,21 +1,21 @@
|
||||
{
|
||||
"name": "supportbot",
|
||||
"version": "7.2.0",
|
||||
"description": "an advanced discord ticket bot",
|
||||
"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": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
"start": "npm i && node index.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/1tzemerald/GlennBot.git"
|
||||
"url": "git+https://github.com/1tzemerald/SupportBot.git"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"author": "Emerald Services",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/1tzemerald/GlennBot/issues"
|
||||
"url": "https://github.com/1tzemerald/SupportBot/issues"
|
||||
},
|
||||
"homepage": "https://github.com/1tzemerald/GlennBot#readme",
|
||||
"homepage": "https://github.com/1tzemerald/SupportBot#readme",
|
||||
"dependencies": {
|
||||
"discord.js": "^13.2.0",
|
||||
"js-yaml": "^4.1.0"
|
||||
|
||||
Reference in new issue
Block a user