fixed some bug

This commit is contained in:
Loic Bersier 2018-12-30 02:14:43 +01:00
parent 6661a110f6
commit b87435bc98
5 changed files with 11 additions and 8 deletions

View file

@ -3,7 +3,7 @@ const { Command } = require('discord-akairo');
class PruneCommand extends Command {
constructor() {
super('Prune', {
aliases: ['Prune'],
aliases: ['Prune', 'clean', 'purge'],
category: 'admin',
args: [
{
@ -23,7 +23,7 @@ class PruneCommand extends Command {
}
async exec(message,args) {
if (args.amount > 99) return;
if (args.amount >= 100) return;
message.channel.bulkDelete(args.amount + 1, true);
}
}

View file

@ -44,7 +44,7 @@ class UnTagCommand extends Command {
}
})}});
return message.say(`The following autoresponse have been deleted: ${trigger}`);
return message.channel.send(`The following autoresponse have been deleted: ${trigger}`);
}
}

View file

@ -43,7 +43,7 @@ class TtsvcCommand extends Command {
fs.writeFile('ttsvc.mp3', response.audioContent, 'binary', err => {
if (err) {
console.error('ERROR:', err);
message.say('An error has occured, the message is probably too long')
message.channel.send('An error has occured, the message is probably too long')
return;
}
console.log('Audio content written to file: ttsvc.mp3');
@ -57,7 +57,7 @@ class TtsvcCommand extends Command {
// If user say "stop" make the bot leave voice channel
if (text == 'stop') {
voiceChannel.leave();
message.say('I leaved the channel');
message.channel.send('I leaved the channel');
} else
voiceChannel.join().then(connection => {
const dispatcher = connection.playStream('./ttsvc.mp3');

View file

@ -1,4 +1,7 @@
const { Command } = require('discord-akairo');
const Discord = require('discord.js');
const SelfReloadJSON = require('self-reload-json');
const fs = require('fs');
class taglistCommand extends Command {
constructor() {

View file

@ -2,6 +2,7 @@ const { Listener } = require('discord-akairo');
const responseObject = require("../json/reply.json");
const reactObject = require("../json/react.json");
const imgResponseObject = require("../json/imgreply.json");
const SelfReloadJSON = require('self-reload-json');
class MessageListener extends Listener {
constructor() {
@ -12,8 +13,7 @@ class MessageListener extends Listener {
}
async exec(message) {
const autoresponse = require("../json/autoresponse.json");
let autoresponse = new SelfReloadJSON('./json/autoresponse.json');
let message_content = message.content.toLowerCase();
if (message.author.bot) return; {
@ -39,7 +39,7 @@ class MessageListener extends Listener {
message.react("496028845967802378")
}
}
const customresponse = require(`../tag/${message.guild.id}.json`);
let customresponse = new SelfReloadJSON(`./tag/${message.guild.id}.json`);
// User autoresponse
if(customresponse[message_content]) {
message.channel.send(customresponse[message_content])