1
0
Fork 0

fixed some bug

akairo
Loic Bersier 6 years ago
parent 6661a110f6
commit b87435bc98

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

@ -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}`);
} }
} }

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

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

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

Loading…
Cancel
Save