Skip to content

Commit

Permalink
Fix /help being broken for most commands.
Browse files Browse the repository at this point in the history
  • Loading branch information
retrixe committed Apr 21, 2021
1 parent 23c6422 commit 8749777
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions server/bot/commands/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,21 @@ TP \`/request\` - Request a specific feature.
}

const generateDocs = (command: Command) => {
const permissions = command.requirements.permissions
? `Needs the permissions: ${Object.keys(command.requirements.permissions).map(perm => (
perm.substr(0, 1).toUpperCase() + perm.substr(1)
).replace(/[A-Z]+/g, s => ' ' + s).trim()).join(', ').replace('TTSMessages', 'TTS Messages')} | ` : ''
const roleNames = command.requirements.roleNames
? `Needs the roles: ${command.requirements.roleNames.join(', ')} | ` : ''
const roleIDs = command.requirements.roleIDs ? 'Usable by users with a certain role | ' : ''
const userIDs = command.requirements.userIDs ? 'Usable by certain users | ' : ''
const custom = command.requirements.custom
? '\n**Requirements:** Has some unknown permission checks | ' : ''
const requirements = custom || (permissions || roleIDs || roleNames || userIDs
? `\n**Requirements:** ${custom}${permissions}${roleIDs}${roleNames}${userIDs}` : '')
let requirements = ''
if (command.requirements) {
const permissions = command.requirements.permissions
? `Needs the permissions: ${Object.keys(command.requirements.permissions).map(perm => (
perm.substr(0, 1).toUpperCase() + perm.substr(1)
).replace(/[A-Z]+/g, s => ' ' + s).trim()).join(', ').replace('TTSMessages', 'TTS Messages')} | ` : ''
const roleNames = command.requirements.roleNames
? `Needs the roles: ${command.requirements.roleNames.join(', ')} | ` : ''
const roleIDs = command.requirements.roleIDs ? 'Usable by users with a certain role | ' : ''
const userIDs = command.requirements.userIDs ? 'Usable by certain users | ' : ''
const custom = command.requirements.custom
? '\n**Requirements:** Has some unknown permission checks | ' : ''
requirements = custom || (permissions || roleIDs || roleNames || userIDs
? `\n**Requirements:** ${custom}${permissions}${roleIDs}${roleNames}${userIDs}` : '')
}

if (command.aliases && command.aliases.length) {
return `
Expand Down

0 comments on commit 8749777

Please sign in to comment.