Merge branch 'master' of https://gitlab.com/LoicBersier/DiscordBot
This commit is contained in:
commit
cfc343e5dc
4 changed files with 16 additions and 18 deletions
|
@ -19,20 +19,18 @@ class shameboardCommand extends Command {
|
||||||
async exec(message) {
|
async exec(message) {
|
||||||
let shameboardChannel = message.channel.id;
|
let shameboardChannel = message.channel.id;
|
||||||
|
|
||||||
fs.readFile(`./starboard/${message.guild.id}.json`, 'utf8', function readFileCallback(err, data) {
|
fs.readFile(`./board/shame${message.guild.id}.json`, 'utf8', function readFileCallback(err, data) {
|
||||||
if (err) {
|
if (err) {
|
||||||
fs.writeFile(`./starboard/${message.guild.id}.json`, `{"shameboard": "${shameboardChannel}"}`, function (err) {
|
fs.writeFile(`./board/shame${message.guild.id}.json`, `{"shameboard": "${shameboardChannel}"}`, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
return message.channel.send('This channel have been set as the shameboard');
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
let shameboard = JSON.parse(data); //now it an object
|
let shameboard = JSON.parse(data); //now it an object
|
||||||
shameboard['shameboard'] = shameboardChannel;
|
shameboard['shameboard'] = shameboardChannel;
|
||||||
var json = JSON.stringify(shameboard); //convert it back to json
|
var json = JSON.stringify(shameboard); //convert it back to json
|
||||||
fs.writeFile(`./starboard/${message.guild.id}.json`, json, 'utf8', function (err) {
|
fs.writeFile(`./board/shame${message.guild.id}.json`, json, 'utf8', function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
||||||
return console.log(err);
|
return console.log(err);
|
||||||
|
|
|
@ -19,20 +19,19 @@ class StarBoardCommand extends Command {
|
||||||
async exec(message) {
|
async exec(message) {
|
||||||
let starboardChannel = message.channel.id;
|
let starboardChannel = message.channel.id;
|
||||||
|
|
||||||
fs.readFile(`./starboard/${message.guild.id}.json`, 'utf8', function readFileCallback(err, data) {
|
fs.readFile(`./board/star${message.guild.id}.json`, 'utf8', function readFileCallback(err, data) {
|
||||||
if (err) {
|
if (err) {
|
||||||
fs.writeFile(`./starboard/${message.guild.id}.json`, `{"starboard": "${starboardChannel}"}`, function (err) {
|
console.log('yes');
|
||||||
|
fs.writeFile(`./board/star${message.guild.id}.json`, `{"starboard": "${starboardChannel}"}`, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
return message.channel.send('This channel have been set as the starboard');
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
let starboard = JSON.parse(data); //now it an object
|
let starboard = JSON.parse(data); //now it an object
|
||||||
starboard['starboard'] = starboardChannel;
|
starboard['starboard'] = starboardChannel;
|
||||||
var json = JSON.stringify(starboard); //convert it back to json
|
var json = JSON.stringify(starboard); //convert it back to json
|
||||||
fs.writeFile(`./starboard/${message.guild.id}.json`, json, 'utf8', function (err) {
|
fs.writeFile(`./board/star${message.guild.id}.json`, json, 'utf8', function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
||||||
return console.log(err);
|
return console.log(err);
|
||||||
|
|
|
@ -15,15 +15,9 @@ class messageListener extends Listener {
|
||||||
async exec(message) {
|
async exec(message) {
|
||||||
let autoresponse = reload('../../json/autoresponse.json');
|
let autoresponse = reload('../../json/autoresponse.json');
|
||||||
let message_content = message.content.toLowerCase();
|
let message_content = message.content.toLowerCase();
|
||||||
let customresponse = reload(`../../tag/${message.guild.id}.json`);
|
|
||||||
|
|
||||||
if (message.author.bot) return; {
|
if (message.author.bot) return; {
|
||||||
|
|
||||||
// User autoresponse
|
|
||||||
if(customresponse[message_content]) {
|
|
||||||
message.channel.send(customresponse[message_content]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If autoresponse is enable send the response
|
// If autoresponse is enable send the response
|
||||||
if(autoresponse[message.channel.id] == 'enable') {
|
if(autoresponse[message.channel.id] == 'enable') {
|
||||||
// Reply with images as attachement
|
// Reply with images as attachement
|
||||||
|
@ -45,6 +39,11 @@ class messageListener extends Listener {
|
||||||
message.react('496028845967802378');
|
message.react('496028845967802378');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// User autoresponse
|
||||||
|
let customresponse = reload(`../../tag/${message.guild.id}.json`);
|
||||||
|
if(customresponse[message_content]) {
|
||||||
|
message.channel.send(customresponse[message_content]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,13 +15,14 @@ class MessageReactionAddListener extends Listener {
|
||||||
let messageContent = reaction.message.content;
|
let messageContent = reaction.message.content;
|
||||||
let messageAttachments = reaction.message.attachments.map(u=> `${u.url}`);
|
let messageAttachments = reaction.message.attachments.map(u=> `${u.url}`);
|
||||||
|
|
||||||
|
// Starboard
|
||||||
if (reaction.emoji.name === '🌟' && reaction.count === 4) {
|
if (reaction.emoji.name === '🌟' && reaction.count === 4) {
|
||||||
if (messageID.includes(reaction.message.id))
|
if (messageID.includes(reaction.message.id))
|
||||||
return console.log('Message already in starboard!');
|
return console.log('Message already in starboard!');
|
||||||
|
|
||||||
messageID.push(reaction.message.id);
|
messageID.push(reaction.message.id);
|
||||||
|
|
||||||
let starboardChannel = reload(`../starboard/${reaction.message.guild.id}.json`);
|
let starboardChannel = reload(`../../board/star${reaction.message.guild.id}.json`);
|
||||||
const channel = this.client.channels.get(starboardChannel['starboard']);
|
const channel = this.client.channels.get(starboardChannel['starboard']);
|
||||||
|
|
||||||
const starEmbed = new MessageEmbed()
|
const starEmbed = new MessageEmbed()
|
||||||
|
@ -33,13 +34,14 @@ class MessageReactionAddListener extends Listener {
|
||||||
channel.send({ embed: starEmbed});
|
channel.send({ embed: starEmbed});
|
||||||
return channel.send(`From: ${reaction.message.channel} ID: ${reaction.message.id} \n${messageAttachments}`);
|
return channel.send(`From: ${reaction.message.channel} ID: ${reaction.message.id} \n${messageAttachments}`);
|
||||||
}
|
}
|
||||||
|
//Shameboard
|
||||||
if (reaction.emoji.name === '✡' && reaction.count === 4) {
|
if (reaction.emoji.name === '✡' && reaction.count === 4) {
|
||||||
if (messageID.includes(reaction.message.id))
|
if (messageID.includes(reaction.message.id))
|
||||||
return console.log('Message already in starboard!');
|
return console.log('Message already in starboard!');
|
||||||
|
|
||||||
messageID.push(reaction.message.id);
|
messageID.push(reaction.message.id);
|
||||||
|
|
||||||
let shameboardChannel = reload(`../starboard/${reaction.message.guild.id}.json`);
|
let shameboardChannel = reload(`../../board/shame${reaction.message.guild.id}.json`);
|
||||||
const channel = this.client.channels.get(shameboardChannel['shameboard']);
|
const channel = this.client.channels.get(shameboardChannel['shameboard']);
|
||||||
|
|
||||||
const shameEmbed = new MessageEmbed()
|
const shameEmbed = new MessageEmbed()
|
||||||
|
|
Loading…
Reference in a new issue