don't use prefix from config.json but from the command handler

This commit is contained in:
loicbersier 2019-12-10 20:06:58 +01:00
parent 729432fa9a
commit 136c981d26
3 changed files with 10 additions and 13 deletions

View file

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

View file

@ -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 <a:loadingmin:527579785212329984>\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 <a:loadingmin:527579785212329984>\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 = {

View file

@ -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 <command>\`.`
`To view details for a command, do \`${this.client.commandHandler.prefix[0]}help <command>\`.`
])
.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;