From 136c981d262df35fbf9b0bdf9dd91cb264ef80ac Mon Sep 17 00:00:00 2001 From: loicbersier Date: Tue, 10 Dec 2019 20:06:58 +0100 Subject: [PATCH] don't use prefix from config.json but from the command handler --- commands/admin/tag.js | 5 ++--- commands/fun/ytp.js | 7 +++---- commands/utility/help.js | 11 +++++------ 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/commands/admin/tag.js b/commands/admin/tag.js index dd758f75..6dfc9030 100644 --- a/commands/admin/tag.js +++ b/commands/admin/tag.js @@ -1,6 +1,5 @@ const { Command } = require('discord-akairo'); const Tag = require('../../models').Tag; -const { prefix } = require('../../config.json'); class TagCommand extends Command { constructor() { @@ -47,7 +46,7 @@ class TagCommand extends Command { Tag.destroy({where: {trigger: args.trigger, serverID: message.guild.id}}); return message.channel.send('successfully deleted the following tag: ' + args.trigger); } else { - return message.channel.send(`You are not the owner of this tag, if you think it is problematic ask an admin to remove it by doing ${prefix[0]}tag ${args.trigger} --remove`); + return message.channel.send(`You are not the owner of this tag, if you think it is problematic ask an admin to remove it by doing ${this.client.commandHandler.prefix[0]}tag ${args.trigger} --remove`); } } else { return message.channel.send('Did not find the specified tag, are you sure it exist?'); @@ -81,7 +80,7 @@ class TagCommand extends Command { return message.channel.send('Took too long to answer. didin\'t update anything.'); }); } else { - return message.channel.send(`You are not the owner of this tag, if you think it is problematic ask an admin to remove it by doing ${prefix[0]}tag ${args.trigger} --remove`); + return message.channel.send(`You are not the owner of this tag, if you think it is problematic ask an admin to remove it by doing ${this.client.commandHandler.prefix[0]}tag ${args.trigger} --remove`); } } } diff --git a/commands/fun/ytp.js b/commands/fun/ytp.js index e724eb4a..3c79d946 100644 --- a/commands/fun/ytp.js +++ b/commands/fun/ytp.js @@ -3,7 +3,6 @@ const YTPGenerator = require('ytpplus-node'); const os = require('os'); const fs = require('fs'); const youtubedl = require('youtube-dl'); -const { prefix } = require('../../config.json'); class ytpCommand extends Command { constructor() { @@ -51,7 +50,7 @@ class ytpCommand extends Command { } }); - return message.channel.send(`There is currently ${mp4.length} videos, you can add yours by doing \`\`${prefix[0]}ytp --add (link or attachment)\`\``); + return message.channel.send(`There is currently ${mp4.length} videos, you can add yours by doing \`\`${this.client.commandHandler.prefix[0]}ytp --add (link or attachment)\`\``); } if (args.add) { @@ -88,7 +87,7 @@ class ytpCommand extends Command { } - if (!message.channel.nsfw && !args.force) return message.channel.send('Please execute this command in an NSFW channel ( Content might not be NSFW but since the video are user submitted better safe than sorry ) OR --force to make the command work outside of nsfw channel BE AWARE THAT IT WON\'T CHANGE THE FINAL RESULT SO NSFW CAN STILL HAPPEN'); + if (!message.channel.nsfw && !args.force) return message.channel.send(`Please execute this command in an NSFW channel ( Content might not be NSFW but since the video are user submitted better safe than sorry ) OR do \`\`${this.client.commandHandler.prefix[0]}--force\`\` to make the command work outside of nsfw channel BE AWARE THAT IT WON'T CHANGE THE FINAL RESULT SO NSFW CAN STILL HAPPEN`); // Read userVid folder and select random vid and only take .mp4 let mp4 = []; @@ -111,7 +110,7 @@ class ytpCommand extends Command { } } - let loadingmsg = await message.channel.send(`Processing, this can take a **long** time, i'll ping you when i finished \nSome info: There is currently ${mp4.length} videos, you can add yours by doing \`\`${prefix[0]}ytp --add (link or attachment)\`\``); + let loadingmsg = await message.channel.send(`Processing, this can take a **long** time, i'll ping you when i finished \nSome info: There is currently ${mp4.length} videos, you can add yours by doing \`\`${this.client.commandHandler.prefix[0]}ytp --add (link or attachment)\`\``); let options = { diff --git a/commands/utility/help.js b/commands/utility/help.js index 4a317ae4..ebef98d0 100644 --- a/commands/utility/help.js +++ b/commands/utility/help.js @@ -1,5 +1,4 @@ const { Command } = require('discord-akairo'); -const { prefix } = require('../../config.json'); class HelpCommand extends Command { constructor() { @@ -39,14 +38,14 @@ class HelpCommand extends Command { const embed = this.client.util.embed() .setColor(message.member.displayHexColor) - .setTitle(`\`${prefix[0]}${command.aliases[0]} ${description.usage}\``) + .setTitle(`\`${this.client.commandHandler.prefix[0]}${command.aliases[0]} ${description.usage}\``) .addField('Description', description.content) - .setFooter(`All the available prefix: ${prefix.join(' | ')}`); + .setFooter(`All the available prefix: ${this.client.commandHandler.prefix.join(' | ')}`); for (const field of description.fields) embed.addField(field.name, field.value); if (description.examples.length) { - const text = `${prefix[0]}${command.aliases[0]}`; + const text = `${this.client.commandHandler.prefix[0]}${command.aliases[0]}`; embed.addField('Examples', `\`${text} ${description.examples.join(`\`\n\`${text} `)}\``, true); } @@ -71,9 +70,9 @@ class HelpCommand extends Command { .addField('Command List', [ 'This is a list of commands.', - `To view details for a command, do \`${prefix[0]}help \`.` + `To view details for a command, do \`${this.client.commandHandler.prefix[0]}help \`.` ]) - .setFooter(`All the available prefix: ${prefix.join(' | ')}`); + .setFooter(`All the available prefix: ${this.client.commandHandler.prefix.join(' | ')}`); for (const category of this.handler.categories.values()) { let title;