6.1 PRE-0.2
This commit is contained in:
1 parent
b6ccf30ae4
commit
f6d4383ff6
31 files changed
+145
-42
No files matched your search
Regular → Executable
+1
-1
@@ -1,4 +1,4 @@
|
||||
// SupportBot Created by Emerald Services
|
||||
// SupportBot 6.0, Created by Emerald Services
|
||||
// Ready Event
|
||||
|
||||
const Discord = require("discord.js");
|
||||
|
||||
Regular → Executable
+2
-2
@@ -1,5 +1,5 @@
|
||||
// SupportBot Created by Emerald Services
|
||||
// Member Remove Event
|
||||
// SupportBot 6.0, Created by Emerald Services
|
||||
// Ready Event
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
Regular → Executable
+1
-1
@@ -1,4 +1,4 @@
|
||||
// SupportBot Created by Emerald Services
|
||||
// SupportBot 6.0, Created by Emerald Services
|
||||
// Message Event
|
||||
|
||||
const Discord = require("discord.js");
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
// SupportBot 6.0, Created by Emerald Services
|
||||
// Message Reaction Event
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
const tickets = yaml.load(fs.readFileSync('./storage/ticketreaction.yml', 'utf8'));
|
||||
|
||||
const reacted = [];
|
||||
|
||||
module.exports = async (bot, message) => {
|
||||
|
||||
// Ticket Creation Panel
|
||||
// This is an embed message where users are able to react and a ticket is created in return.
|
||||
|
||||
bot.on('messageReactionAdd', async (reaction, user) => {
|
||||
|
||||
|
||||
if (supportbot.ReactionTickets === "true") {
|
||||
|
||||
|
||||
|
||||
if (reaction.message.id === tickets.ReactionMessage_ID) {
|
||||
|
||||
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 cmd = bot.commands.get(supportbot.NewTicket);
|
||||
if(!cmd) return;
|
||||
console.log("1")
|
||||
cmd.execute(bot, message, args);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
};
|
||||
Regular → Executable
+33
-2
@@ -1,4 +1,4 @@
|
||||
// SupportBot Created by Emerald Services
|
||||
// SupportBot 6.0, Created by Emerald Services
|
||||
// Ready Event
|
||||
|
||||
const Discord = require("discord.js");
|
||||
@@ -6,6 +6,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'));
|
||||
|
||||
|
||||
module.exports = async (bot) => {
|
||||
@@ -16,4 +17,34 @@ module.exports = async (bot) => {
|
||||
console.log(`\u001b[32m`, `―――――――――――――――――― SupportBot ――――――――――――――――――`)
|
||||
console.log(`\u001b[37m`, `${supportbot.Bot_Name} has successfully connected to discord`)
|
||||
console.log(`\u001b[32m`, `―――――――――――――――――― SupportBot ――――――――――――――――――`)
|
||||
};
|
||||
|
||||
if (supportbot.ReactionTickets === "true") {
|
||||
let chan1 = bot.channels.cache.find(channel => channel.name === supportbot.ReactionChannel)
|
||||
|
||||
if (!chan1) {
|
||||
console.log('\u001b[33m', "[WARN] Ticket reaction panel is not setup, You can do so via the configuration file!")
|
||||
return false;
|
||||
}
|
||||
|
||||
chan1.messages.fetch(tickets.ReactionMessage_ID).catch(r => {
|
||||
let embed = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.ReactionMessage.replace(/%reaction_emoji%/g, supportbot.ReactionEmoji))
|
||||
.setColor(supportbot.SuccessColour)
|
||||
.setFooter(supportbot.EmbedFooter);
|
||||
|
||||
bot.channels.cache.find(channel => channel.name === supportbot.ReactionChannel).send({
|
||||
embed: embed
|
||||
}).then(r => {
|
||||
let data = {
|
||||
"ReactionMessage_ID": `${r.id}`
|
||||
}
|
||||
let yamlStr = yaml.dump(data);
|
||||
fs.writeFileSync('./storage/ticketreaction.yml', yamlStr, 'utf8');
|
||||
r.react(supportbot.ReactionEmoji)
|
||||
}).catch(e => {
|
||||
console.log(e)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
};
|
||||
Reference in new issue
Block a user