fixed something annoying

This commit is contained in:
Loic Bersier 2018-12-06 23:01:40 +01:00
parent 57ab7f07e6
commit 045e8d9503
34 changed files with 41 additions and 41 deletions

View file

@ -36,7 +36,7 @@ module.exports = class AutoresponseCommand extends Command {
if (all == 'all') { if (all == 'all') {
const guild = this.client.guilds.get(message.guild.id); const guild = this.client.guilds.get(message.guild.id);
fs.readFile('DiscordBot/json/autoresponse.json', 'utf8', function readFileCallback(err, data){ fs.readFile('./json/autoresponse.json', 'utf8', function readFileCallback(err, data){
if (err){ if (err){
console.log(err); console.log(err);
} else { } else {
@ -44,7 +44,7 @@ module.exports = class AutoresponseCommand extends Command {
guild.channels.forEach(channel => autoresponse [channel] = text) guild.channels.forEach(channel => autoresponse [channel] = text)
json = JSON.stringify(autoresponse); //convert it back to json json = JSON.stringify(autoresponse); //convert it back to json
json = json.replace(/[<#>]/g, '') json = json.replace(/[<#>]/g, '')
fs.writeFile('DiscordBot/json/autoresponse.json', json, 'utf8', function(err) { fs.writeFile('./json/autoresponse.json', json, 'utf8', function(err) {
if(err) { if(err) {
return console.log(err); return console.log(err);
} }
@ -52,14 +52,14 @@ module.exports = class AutoresponseCommand extends Command {
return message.say('Auto response have been disable/enable on every channel') return message.say('Auto response have been disable/enable on every channel')
} else if(text == 'disable' || 'enable') { } else if(text == 'disable' || 'enable') {
fs.readFile('DiscordBot/json/autoresponse.json', 'utf8', function readFileCallback(err, data){ fs.readFile('./json/autoresponse.json', 'utf8', function readFileCallback(err, data){
if (err){ if (err){
console.log(err); console.log(err);
} else { } else {
autoresponse = JSON.parse(data); //now it an object autoresponse = JSON.parse(data); //now it an object
autoresponse [message.channel.id] = text autoresponse [message.channel.id] = text
json = JSON.stringify(autoresponse); //convert it back to json json = JSON.stringify(autoresponse); //convert it back to json
fs.writeFile('DiscordBot/json/autoresponse.json', json, 'utf8', function(err) { fs.writeFile('./json/autoresponse.json', json, 'utf8', function(err) {
if(err) { if(err) {
return console.log(err); return console.log(err);
} }

View file

@ -15,7 +15,7 @@ module.exports = class AdviceCommand extends Command {
} }
async run(message) { async run(message) {
let blacklistJson = new SelfReloadJSON('DiscordBot/json/blacklist.json'); let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
if(blacklistJson[message.author.id]) if(blacklistJson[message.author.id])
return blacklist(blacklistJson[message.author.id] , message) return blacklist(blacklistJson[message.author.id] , message)

View file

@ -14,7 +14,7 @@ module.exports = class BadMemeCommand extends Command {
} }
async run(message) { async run(message) {
let blacklistJson = new SelfReloadJSON('DiscordBot/json/blacklist.json'); let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
if(blacklistJson[message.author.id]) if(blacklistJson[message.author.id])
return blacklist(blacklistJson[message.author.id] , message) return blacklist(blacklistJson[message.author.id] , message)

View file

@ -19,7 +19,7 @@ module.exports = class clapCommand extends Command {
} }
async run(message, { text }) { async run(message, { text }) {
let blacklistJson = new SelfReloadJSON('DiscordBot/json/blacklist.json'); let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
if(blacklistJson[message.author.id]) if(blacklistJson[message.author.id])
return blacklist(blacklistJson[message.author.id] , message) return blacklist(blacklistJson[message.author.id] , message)

View file

@ -13,7 +13,7 @@ module.exports = class dankCommand extends Command {
} }
async run(message) { async run(message) {
let blacklistJson = new SelfReloadJSON('DiscordBot/json/blacklist.json'); let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
if(blacklistJson[message.author.id]) if(blacklistJson[message.author.id])
return blacklist(blacklistJson[message.author.id] , message) return blacklist(blacklistJson[message.author.id] , message)

View file

@ -24,7 +24,7 @@ module.exports = class DespacitoCommand extends Command {
} }
async run(message, { user }) { async run(message, { user }) {
let blacklistJson = new SelfReloadJSON('DiscordBot/json/blacklist.json'); let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
if(blacklistJson[message.author.id]) if(blacklistJson[message.author.id])
return blacklist(blacklistJson[message.author.id] , message) return blacklist(blacklistJson[message.author.id] , message)

View file

@ -20,7 +20,7 @@ module.exports = class emoteSayCommand extends Command {
} }
async run(message, { text }) { async run(message, { text }) {
let blacklistJson = new SelfReloadJSON('DiscordBot/json/blacklist.json'); let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
if(blacklistJson[message.author.id]) if(blacklistJson[message.author.id])
return blacklist(blacklistJson[message.author.id] , message) return blacklist(blacklistJson[message.author.id] , message)

View file

@ -13,7 +13,7 @@ module.exports = class FunFactCommand extends Command {
} }
async run(message) { async run(message) {
let blacklistJson = new SelfReloadJSON('DiscordBot/json/blacklist.json'); let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
if(blacklistJson[message.author.id]) if(blacklistJson[message.author.id])
return blacklist(blacklistJson[message.author.id] , message) return blacklist(blacklistJson[message.author.id] , message)

View file

@ -15,7 +15,7 @@ module.exports = class BadMemeCommand extends Command {
} }
async run(message) { async run(message) {
let blacklistJson = new SelfReloadJSON('DiscordBot/json/blacklist.json'); let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
if(blacklistJson[message.author.id]) if(blacklistJson[message.author.id])
return blacklist(blacklistJson[message.author.id] , message) return blacklist(blacklistJson[message.author.id] , message)

View file

@ -25,7 +25,7 @@ module.exports = class printCommand extends Command {
} }
async run(message, { text }) { async run(message, { text }) {
let blacklistJson = new SelfReloadJSON('DiscordBot/json/blacklist.json'); let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
if(blacklistJson[message.author.id]) if(blacklistJson[message.author.id])
return blacklist(blacklistJson[message.author.id] , message) return blacklist(blacklistJson[message.author.id] , message)

View file

@ -21,7 +21,7 @@ module.exports = class redditCommand extends Command {
} }
async run(message, { sub }) { async run(message, { sub }) {
let blacklistJson = new SelfReloadJSON('DiscordBot/json/blacklist.json'); let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
if(blacklistJson[message.author.id]) if(blacklistJson[message.author.id])
return blacklist(blacklistJson[message.author.id] , message) return blacklist(blacklistJson[message.author.id] , message)

View file

@ -20,7 +20,7 @@ module.exports = class sayCommand extends Command {
} }
async run(message, { text }) { async run(message, { text }) {
let blacklistJson = new SelfReloadJSON('DiscordBot/json/blacklist.json'); let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
if(blacklistJson[message.author.id]) if(blacklistJson[message.author.id])
return blacklist(blacklistJson[message.author.id] , message) return blacklist(blacklistJson[message.author.id] , message)

View file

@ -20,7 +20,7 @@ module.exports = class saydCommand extends Command {
} }
async run(message, { text }) { async run(message, { text }) {
let blacklistJson = new SelfReloadJSON('DiscordBot/json/blacklist.json'); let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
if(blacklistJson[message.author.id]) if(blacklistJson[message.author.id])
return blacklist(blacklistJson[message.author.id] , message) return blacklist(blacklistJson[message.author.id] , message)

View file

@ -30,7 +30,7 @@ module.exports = class faceappCommand extends Command {
} }
async run(message, { url, type }) { async run(message, { url, type }) {
let blacklistJson = new SelfReloadJSON('DiscordBot/json/blacklist.json'); let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
if(blacklistJson[message.author.id]) if(blacklistJson[message.author.id])
return blacklist(blacklistJson[message.author.id] , message) return blacklist(blacklistJson[message.author.id] , message)

View file

@ -17,7 +17,7 @@ module.exports = class fetishCommand extends Command {
} }
async run(message) { async run(message) {
let blacklistJson = new SelfReloadJSON('DiscordBot/json/blacklist.json'); let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
if(blacklistJson[message.author.id]) if(blacklistJson[message.author.id])
return blacklist(blacklistJson[message.author.id] , message) return blacklist(blacklistJson[message.author.id] , message)

View file

@ -17,7 +17,7 @@ module.exports = class godCommand extends Command {
} }
async run(message) { async run(message) {
let blacklistJson = new SelfReloadJSON('DiscordBot/json/blacklist.json'); let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
if(blacklistJson[message.author.id]) if(blacklistJson[message.author.id])
return blacklist(blacklistJson[message.author.id] , message) return blacklist(blacklistJson[message.author.id] , message)

View file

@ -17,7 +17,7 @@ module.exports = class humanCommand extends Command {
} }
async run(message) { async run(message) {
let blacklistJson = new SelfReloadJSON('DiscordBot/json/blacklist.json'); let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
if(blacklistJson[message.author.id]) if(blacklistJson[message.author.id])
return blacklist(blacklistJson[message.author.id] , message) return blacklist(blacklistJson[message.author.id] , message)

View file

@ -26,7 +26,7 @@ module.exports = class idubbbzCommand extends Command {
} }
async run(message, { text }) { async run(message, { text }) {
let blacklistJson = new SelfReloadJSON('DiscordBot/json/blacklist.json'); let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
if(blacklistJson[message.author.id]) if(blacklistJson[message.author.id])
return blacklist(blacklistJson[message.author.id] , message) return blacklist(blacklistJson[message.author.id] , message)

View file

@ -26,7 +26,7 @@ module.exports = class idubbbzpaintCommand extends Command {
} }
async run(message, { text }) { async run(message, { text }) {
let blacklistJson = new SelfReloadJSON('DiscordBot/json/blacklist.json'); let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
if(blacklistJson[message.author.id]) if(blacklistJson[message.author.id])
return blacklist(blacklistJson[message.author.id] , message) return blacklist(blacklistJson[message.author.id] , message)

View file

@ -17,7 +17,7 @@ module.exports = class likeCommand extends Command {
} }
async run(message) { async run(message) {
let blacklistJson = new SelfReloadJSON('DiscordBot/json/blacklist.json'); let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
if(blacklistJson[message.author.id]) if(blacklistJson[message.author.id])
return blacklist(blacklistJson[message.author.id] , message) return blacklist(blacklistJson[message.author.id] , message)

View file

@ -17,7 +17,7 @@ module.exports = class uglyCommand extends Command {
} }
async run(message) { async run(message) {
let blacklistJson = new SelfReloadJSON('DiscordBot/json/blacklist.json'); let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
if(blacklistJson[message.author.id]) if(blacklistJson[message.author.id])
return blacklist(blacklistJson[message.author.id] , message) return blacklist(blacklistJson[message.author.id] , message)

View file

@ -21,7 +21,7 @@ module.exports = class AvatarCommand extends Command {
} }
async run(message, { user }) { async run(message, { user }) {
let blacklistJson = new SelfReloadJSON('DiscordBot/json/blacklist.json'); let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
if(blacklistJson[message.author.id]) if(blacklistJson[message.author.id])
return blacklist(blacklistJson[message.author.id] , message) return blacklist(blacklistJson[message.author.id] , message)

View file

@ -23,7 +23,7 @@ module.exports = class downloadCommand extends Command {
} }
async run(message, { link }) { async run(message, { link }) {
let blacklistJson = new SelfReloadJSON('DiscordBot/json/blacklist.json'); let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
if(blacklistJson[message.author.id]) if(blacklistJson[message.author.id])
return blacklist(blacklistJson[message.author.id] , message) return blacklist(blacklistJson[message.author.id] , message)

View file

@ -25,7 +25,7 @@ module.exports = class feedbackCommand extends Command {
} }
async run(message, { text }) { async run(message, { text }) {
let blacklistJson = new SelfReloadJSON('DiscordBot/json/blacklist.json'); let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
if(blacklistJson[message.author.id]) if(blacklistJson[message.author.id])
return blacklist(blacklistJson[message.author.id] , message) return blacklist(blacklistJson[message.author.id] , message)

View file

@ -21,7 +21,7 @@ module.exports = class InfoCommand extends Command {
} }
async run(message, { search }) { async run(message, { search }) {
let blacklistJson = new SelfReloadJSON('DiscordBot/json/blacklist.json'); let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
if(blacklistJson[message.author.id]) if(blacklistJson[message.author.id])
return blacklist(blacklistJson[message.author.id] , message) return blacklist(blacklistJson[message.author.id] , message)

View file

@ -13,7 +13,7 @@ module.exports = class InviteCommand extends Command {
} }
async run(message) { async run(message) {
let blacklistJson = new SelfReloadJSON('DiscordBot/json/blacklist.json'); let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
if(blacklistJson[message.author.id]) if(blacklistJson[message.author.id])
return blacklist(blacklistJson[message.author.id] , message) return blacklist(blacklistJson[message.author.id] , message)

View file

@ -17,7 +17,7 @@ module.exports = class PingCommand extends Command {
} }
async run(message) { async run(message) {
let blacklistJson = new SelfReloadJSON('DiscordBot/json/blacklist.json'); let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
if(blacklistJson[message.author.id]) if(blacklistJson[message.author.id])
return blacklist(blacklistJson[message.author.id] , message) return blacklist(blacklistJson[message.author.id] , message)

View file

@ -12,7 +12,7 @@ module.exports = class statsCommand extends Command {
} }
async run(message) { async run(message) {
let blacklistJson = new SelfReloadJSON('DiscordBot/json/blacklist.json'); let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
if(blacklistJson[message.author.id]) if(blacklistJson[message.author.id])
return blacklist(blacklistJson[message.author.id] , message) return blacklist(blacklistJson[message.author.id] , message)

View file

@ -12,7 +12,7 @@ module.exports = class supportMeCommand extends Command {
} }
async run(message, { text }) { async run(message, { text }) {
let blacklistJson = new SelfReloadJSON('DiscordBot/json/blacklist.json'); let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
if(blacklistJson[message.author.id]) if(blacklistJson[message.author.id])
return blacklist(blacklistJson[message.author.id] , message) return blacklist(blacklistJson[message.author.id] , message)

View file

@ -40,9 +40,9 @@ module.exports = class CustomResponseCommand extends Command {
fs.readFile(`DiscordBot/tag/${message.guild.id}.json`, 'utf8', function readFileCallback(err, data){ fs.readFile(`./tag/${message.guild.id}.json`, 'utf8', function readFileCallback(err, data){
if (err){ if (err){
fs.writeFile(`DiscordBot/tag/${message.guild.id}.json`, `{"${trigger}":"${response}"}`, function (err) { fs.writeFile(`./tag/${message.guild.id}.json`, `{"${trigger}":"${response}"}`, function (err) {
if (err){ if (err){
console.log(err); console.log(err);
} }
@ -51,7 +51,7 @@ module.exports = class CustomResponseCommand extends Command {
customresponse = JSON.parse(data); //now it an object customresponse = JSON.parse(data); //now it an object
customresponse [trigger] = response customresponse [trigger] = response
json = JSON.stringify(customresponse); //convert it back to json json = JSON.stringify(customresponse); //convert it back to json
fs.writeFile(`DiscordBot/tag/${message.guild.id}.json`, json, 'utf8', function(err) { fs.writeFile(`./tag/${message.guild.id}.json`, json, 'utf8', function(err) {
if(err) { if(err) {
return console.log(err); return console.log(err);
} }

View file

@ -31,7 +31,7 @@ module.exports = class translationCommand extends Command {
} }
async run(message, { text, language }) { async run(message, { text, language }) {
let blacklistJson = new SelfReloadJSON('DiscordBot/json/blacklist.json'); let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
if(blacklistJson[message.author.id]) if(blacklistJson[message.author.id])
return blacklist(blacklistJson[message.author.id] , message) return blacklist(blacklistJson[message.author.id] , message)

View file

@ -29,14 +29,14 @@ module.exports = class CustomResponseCommand extends Command {
let json = JSON.stringify(customresponse) let json = JSON.stringify(customresponse)
fs.readFile(`DiscordBot/tag/${message.guild.id}.json`, 'utf8', function readFileCallback(err, data){ fs.readFile(`./tag/${message.guild.id}.json`, 'utf8', function readFileCallback(err, data){
if (err){ if (err){
console.log(err); console.log(err);
} else { } else {
customresponse = JSON.parse(data); //now it an object customresponse = JSON.parse(data); //now it an object
customresponse [trigger] = '' customresponse [trigger] = ''
json = JSON.stringify(customresponse); //convert it back to json json = JSON.stringify(customresponse); //convert it back to json
fs.writeFile(`DiscordBot/tag/${message.guild.id}.json`, json, 'utf8', function(err) { fs.writeFile(`./tag/${message.guild.id}.json`, json, 'utf8', function(err) {
if(err) { if(err) {
return console.log(err); return console.log(err);
} }

View file

@ -13,7 +13,7 @@ module.exports = class UpDootCommand extends Command {
} }
async run(message) { async run(message) {
let blacklistJson = new SelfReloadJSON('DiscordBot/json/blacklist.json'); let blacklistJson = new SelfReloadJSON('./json/blacklist.json');
if(blacklistJson[message.author.id]) if(blacklistJson[message.author.id])
return blacklist(blacklistJson[message.author.id] , message) return blacklist(blacklistJson[message.author.id] , message)

View file

@ -75,8 +75,8 @@ client.registry
}); });
client.on("message", async (message) => { client.on("message", async (message) => {
var customresponse = new SelfReloadJSON(`DisocrdBot/tag/${message.guild.id}.json`); var customresponse = new SelfReloadJSON(`./tag/${message.guild.id}.json`);
var autoresponse = new SelfReloadJSON('DiscordBot/json/autoresponse.json'); var autoresponse = new SelfReloadJSON('./json/autoresponse.json');
let message_content = message.content.toLowerCase(); let message_content = message.content.toLowerCase();
if (message.author.bot) return; { if (message.author.bot) return; {