Fix help not indicating that the bot username needs to be mentioned
This commit is contained in:
parent
c1750e0842
commit
ae16f1cce9
|
@ -11,17 +11,17 @@ module.exports = new Command({
|
||||||
invoke
|
invoke
|
||||||
});
|
});
|
||||||
|
|
||||||
function invoke({ commands, isMemberAdmin }) {
|
function invoke({ commands, isMemberAdmin, client }) {
|
||||||
return Promise.resolve(createHelpEmbed(ParentPackageJson.name, commands, isMemberAdmin));
|
return Promise.resolve(createHelpEmbed(ParentPackageJson.name, commands, isMemberAdmin, client.user.username));
|
||||||
}
|
}
|
||||||
|
|
||||||
function createHelpEmbed(name, commands, userIsAdmin) {
|
function createHelpEmbed(name, commands, userIsAdmin, username) {
|
||||||
const commandsArr = Object.keys(commands).map(x => commands[x]).filter(x => userIsAdmin || !x.admin);
|
const commandsArr = Object.keys(commands).map(x => commands[x]).filter(x => userIsAdmin || !x.admin);
|
||||||
|
|
||||||
const embed = new Discord.RichEmbed().setTitle(`__${(ParentPackageJson.name + "").replace("discord-bot-", "")} help__`);
|
const embed = new Discord.RichEmbed().setTitle(`__${(ParentPackageJson.name + "").replace("discord-bot-", "")} help__`);
|
||||||
|
|
||||||
commandsArr.forEach(command => {
|
commandsArr.forEach(command => {
|
||||||
embed.addField(command.name, `${command.description}\n**Usage:** *${name} ${command.syntax}*${userIsAdmin && command.admin ? "\n***Admin only***" : ""}`);
|
embed.addField(command.name, `${command.description}\n**Usage:** *@${username} ${command.syntax}*${userIsAdmin && command.admin ? "\n***Admin only***" : ""}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
embed.addField("__Need more help?__", `[Visit my website](${InternalConfig.website}) or [Join my Discord](${InternalConfig.discordInvite})`, true);
|
embed.addField("__Need more help?__", `[Visit my website](${InternalConfig.website}) or [Join my Discord](${InternalConfig.discordInvite})`, true);
|
||||||
|
|
Loading…
Reference in a new issue