SB-6.1-PRE
This commit is contained in:
1 parent
690169a409
commit
358a25f522
3760 files changed
+300059
-36
No files matched your search
@@ -7,39 +7,48 @@ const fs = require("fs");
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
const tickets = yaml.load(fs.readFileSync('./storage/ticketreaction.yml', 'utf8'));
|
||||
const verif = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
const reacted = [];
|
||||
module.exports = async (client, reaction, user) => {
|
||||
|
||||
module.exports = async (bot, message, reaction, user) => {
|
||||
let message = {
|
||||
guild: reaction.message.channel.guild,
|
||||
author: user,
|
||||
content: "Not available",
|
||||
channel: reaction.message.channel
|
||||
}
|
||||
|
||||
// Ticket Creation Panel
|
||||
// This is an embed message where users are able to react and a ticket is created in return.
|
||||
if (supportbot.ReactionTickets === "true") {
|
||||
if (supportbot.ReactionTickets === "true") {
|
||||
if (reaction.message.id === tickets.ReactionMessage_ID) {
|
||||
switch (reaction.emoji.id) {
|
||||
case supportbot.ReactionEmoji: {
|
||||
await reaction.users.remove(user.id)
|
||||
|
||||
if (reaction.message.id === tickets.ReactionMessage_ID) {
|
||||
try {
|
||||
const cmd = client.commands.get("ticket");
|
||||
if(!cmd) return;
|
||||
|
||||
let user = await reaction.message.guild.members.fetch(user);
|
||||
|
||||
switch (reaction.emoji.id) {
|
||||
case supportbot.ReactionEmoji: {
|
||||
reaction.message.guild.members.fetch(user).then(r => {
|
||||
reaction.users.remove(r.id)
|
||||
});
|
||||
|
||||
const ticketCMD = supportbot.NewTicket;
|
||||
try {
|
||||
const cmd = bot.commands.get("ticket");
|
||||
if(!cmd) return;
|
||||
console.log("1")
|
||||
cmd.execute(bot, message);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
cmd.execute(message, "undefined");
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (supportbot.Verification === "true") {
|
||||
if (reaction.message.id === verif.verification_msg) {
|
||||
switch (reaction.emoji.id) {
|
||||
case supportbot.VerificationEmoji: {
|
||||
await reaction.users.remove(user.id)
|
||||
|
||||
let r = reaction.message.channel.guild.roles.cache.find(r => r.name === "verified")
|
||||
|
||||
await reaction.message.channel.guild.members.cache.get(user.id).roles.add(r)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
+27
-1
@@ -7,7 +7,7 @@ const fs = require("fs");
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
const tickets = yaml.load(fs.readFileSync('./storage/ticketreaction.yml', 'utf8'));
|
||||
|
||||
const verif = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
module.exports = async (bot) => {
|
||||
bot.user.setActivity(supportbot.BotActivity, {
|
||||
@@ -47,4 +47,30 @@ module.exports = async (bot) => {
|
||||
})
|
||||
}
|
||||
|
||||
if (supportbot.Verification === "true") {
|
||||
let chan2 = bot.channels.cache.find(channel => channel.name === supportbot.Verification_Channel)
|
||||
|
||||
if (!chan2) {
|
||||
console.log('\u001b[33m', "[WARN] Verification Reaction panel is not setup, You can do so via the configuration file!")
|
||||
return false;
|
||||
}
|
||||
|
||||
chan2.messages.fetch(verif.verification_msg).catch(r => {
|
||||
let embed = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.VerificationMessage.replace(/%VerificationEmoji%/g, supportbot.VerificationEmoji))
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter(supportbot.EmbedFooter);
|
||||
|
||||
bot.channels.cache.find(channel => channel.name === supportbot.Verification_Channel).send({embed: embed}).then(r => {
|
||||
let data = {
|
||||
"verification_msg": `${r.id}`
|
||||
}
|
||||
let yamlStr = yaml.dump(data);
|
||||
fs.writeFileSync('./storage/verification.yml', yamlStr, 'utf8');
|
||||
r.react(supportbot.VerificationEmoji)
|
||||
}).catch(e => {
|
||||
console.log(e)
|
||||
})
|
||||
})
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user