fix: help command permissions parsing

merge-requests/6/head
Hiroyuki 2021-09-11 16:46:27 -04:00
parent 12aab5aa56
commit f4f5fdf381
No known key found for this signature in database
GPG Key ID: AF65958B7B7362E6
1 changed files with 2 additions and 2 deletions

View File

@ -20,9 +20,9 @@ export default class Help extends Command {
const commands = this.client.commands.map((c) => { const commands = this.client.commands.map((c) => {
const aliases = c.aliases.map((alias) => `${this.client.config.prefix}${alias}`).join(', '); const aliases = c.aliases.map((alias) => `${this.client.config.prefix}${alias}`).join(', ');
const perms: string[] = []; const perms: string[] = [];
let allowedRoles = c.permissions && c.permissions.roles && c.permissions.roles.map((r) => r.toString()).join(', '); let allowedRoles = c.permissions && c.permissions.roles && c.permissions.roles.map((r) => `<@&${r}>`).join(', ');
if (allowedRoles) { allowedRoles = `**Roles:** ${allowedRoles}`; perms.push(allowedRoles); } if (allowedRoles) { allowedRoles = `**Roles:** ${allowedRoles}`; perms.push(allowedRoles); }
let allowedUsers = c.permissions && c.permissions.users && c.permissions.users.map((u) => u.toString()).join(', '); let allowedUsers = c.permissions && c.permissions.users && c.permissions.users.map((u) => `<@!${u}>`).join(', ');
if (allowedUsers) { allowedUsers = `**Users:** ${allowedUsers}`; perms.push(allowedUsers); } if (allowedUsers) { allowedUsers = `**Users:** ${allowedUsers}`; perms.push(allowedUsers); }
const displayedPerms = perms.length ? `**Permissions:**\n${perms.join('\n')}` : ''; const displayedPerms = perms.length ? `**Permissions:**\n${perms.join('\n')}` : '';
return { name: `${this.client.config.prefix}${c.name}`, value: `**Description:** ${c.description}\n**Aliases:** ${aliases}\n**Usage:** ${c.usage}\n${displayedPerms}`, inline: false }; return { name: `${this.client.config.prefix}${c.name}`, value: `**Description:** ${c.description}\n**Aliases:** ${aliases}\n**Usage:** ${c.usage}\n${displayedPerms}`, inline: false };