Skip to content

Commit

Permalink
Rename Command/CommandInfo description -> desc, extraHelp -> info
Browse files Browse the repository at this point in the history
  • Loading branch information
zajrik committed Jun 11, 2017
1 parent 4dc2125 commit 721d8ad
Show file tree
Hide file tree
Showing 16 changed files with 33 additions and 33 deletions.
6 changes: 3 additions & 3 deletions src/command/Command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ export class Command<T extends Client = Client>
{
public client: T;
public name: string;
public description: string;
public desc: string;
public usage: string;
public extraHelp: string;
public info: string;
public group: string;
public aliases: string[];
public guildOnly: boolean;
Expand Down Expand Up @@ -197,7 +197,7 @@ export class Command<T extends Client = Client>

// Make necessary asserts
if (!this.name) throw new Error(`A command is missing a name`);
if (!this.description) throw new Error(`A description must be provided for Command: ${this.name}`);
if (!this.desc) throw new Error(`A description must be provided for Command: ${this.name}`);
if (!this.usage) throw new Error(`Usage information must be provided for Command: ${this.name}`);
if (this.aliases && !Array.isArray(this.aliases)) throw new TypeError(`Aliases for Command "${this.name}" must be an array of alias strings`);
if (this.callerPermissions && !Array.isArray(this.callerPermissions)) throw new TypeError(`\`callerPermissions\` for Command "${this.name}" must be an array`);
Expand Down
2 changes: 1 addition & 1 deletion src/command/base/Eval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default class extends Command
{
super({
name: 'eval',
description: 'Evaluate provided Javascript code',
desc: 'Evaluate provided Javascript code',
usage: '<prefix>eval <...code>',
ownerOnly: true
});
Expand Down
4 changes: 2 additions & 2 deletions src/command/base/EvalTS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ export default class extends Command
{
super({
name: 'eval:ts',
description: 'Evaluate provided Typescript code',
desc: 'Evaluate provided Typescript code',
usage: '<prefix>eval:ts <...code>',
extraHelp: 'Runs pretty slowly due to having to run diagnostics before compiling. If Typescript is not installed the provided code will be evaluated as Javascript and diagnostics/compilation will be skipped.',
info: 'Runs pretty slowly due to having to run diagnostics before compiling. If Typescript is not installed the provided code will be evaluated as Javascript and diagnostics/compilation will be skipped.',
ownerOnly: true
});
}
Expand Down
10 changes: 5 additions & 5 deletions src/command/base/Help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ export default class extends Command
{
super({
name: 'help',
description: 'Provides information on bot commands',
desc: 'Provides information on bot commands',
usage: `<prefix>help [command]`,
extraHelp: 'Will DM bot command help information to the user to keep clutter down in guild channels. If you use the help command from within a DM you will only receive information for the commands you can use within the DM. If you want help with commands usable in a guild, call the help command in a guild channel. You will receive a list of the commands that you have permissions/roles for in that channel.'
info: 'Will DM bot command help information to the user to keep clutter down in guild channels. If you use the help command from within a DM you will only receive information for the commands you can use within the DM. If you want help with commands usable in a guild, call the help command in a guild channel. You will receive a list of the commands that you have permissions/roles for in that channel.'
});
}

Expand All @@ -37,7 +37,7 @@ export default class extends Command

const widest: number = usableCommands.map(c => c.name.length).reduce((a, b) => Math.max(a, b));
let commandList: string = usableCommands.map(c =>
`${Util.padRight(c.name, widest + 1)}${c.guildOnly ? '*' : ' '}: ${c.description}`).sort().join('\n');
`${Util.padRight(c.name, widest + 1)}${c.guildOnly ? '*' : ' '}: ${c.desc}`).sort().join('\n');

output = preText + commandList + postText;
if (output.length >= 1024)
Expand Down Expand Up @@ -67,10 +67,10 @@ export default class extends Command
+ (command.guildOnly ? '[Server Only]\n' : '')
+ (command.ownerOnly ? '[Owner Only]\n' : '')
+ `Command: ${command.name}\n`
+ `Description: ${command.description}\n`
+ `Description: ${command.desc}\n`
+ (command.aliases.length > 0 ? `Aliases: ${command.aliases.join(', ')}\n` : '')
+ `Usage: ${command.usage}\n`
+ (command.extraHelp ? `\n${command.extraHelp}` : '')
+ (command.info ? `\n${command.info}` : '')
+ '\n```';
}

Expand Down
2 changes: 1 addition & 1 deletion src/command/base/Ping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default class extends Command
{
super({
name: 'ping',
description: 'Pong!',
desc: 'Pong!',
usage: '<prefix>ping'
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/command/base/Reload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ export default class extends Command
{
super({
name: 'reload',
description: 'Reload a command or all commands',
desc: 'Reload a command or all commands',
usage: '<prefix>reload [command]',
extraHelp: `If a command name or alias is provided the specific command will be reloaded. Otherwise, all commands will be reloaded.`,
info: `If a command name or alias is provided the specific command will be reloaded. Otherwise, all commands will be reloaded.`,
ownerOnly: true
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/command/base/SetPrefix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ export default class extends Command
{
super({
name: 'setprefix',
description: 'Set or check command prefix',
desc: 'Set or check command prefix',
aliases: ['prefix'],
usage: '<prefix>setprefix [prefix]',
extraHelp: 'Prefixes may be 1-10 characters in length and may not include backslashes or backticks. Use "clear" to clear the prefix and allow commands to be called without a prefix.',
info: 'Prefixes may be 1-10 characters in length and may not include backslashes or backticks. Use "clear" to clear the prefix and allow commands to be called without a prefix.',
callerPermissions: ['ADMINISTRATOR']
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/command/base/Version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default class extends Command
{
super({
name: 'version',
description: 'Get the version of the bot',
desc: 'Get the version of the bot',
usage: `<prefix>version`
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/command/base/blacklist/Blacklist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ export default class extends Command
{
super({
name: 'blacklist',
description: 'Blacklist a user from calling commands',
desc: 'Blacklist a user from calling commands',
aliases: ['bl'],
usage: '<prefix>blacklist <user> [\'global\']',
extraHelp: 'If global, this will block the user from calling commands in ANY server and DMs',
info: 'If global, this will block the user from calling commands in ANY server and DMs',
callerPermissions: ['ADMINISTRATOR']
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/command/base/blacklist/Whitelist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default class extends Command
{
super({
name: 'whitelist',
description: 'Remove a user from the command blacklist',
desc: 'Remove a user from the command blacklist',
aliases: ['wl'],
usage: '<prefix>whitelist <user> [\'global\']',
callerPermissions: ['ADMINISTRATOR']
Expand Down
2 changes: 1 addition & 1 deletion src/command/base/groupcontrol/ClearLimit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default class extends Command
{
super({
name: 'clearlimit',
description: 'Clear role restrictions from a command',
desc: 'Clear role restrictions from a command',
usage: '<prefix>clearlimit <command>',
callerPermissions: ['ADMINISTRATOR']
});
Expand Down
4 changes: 2 additions & 2 deletions src/command/base/groupcontrol/DisableGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ export default class extends Command
{
super({
name: 'disablegroup',
description: 'Disable a command group',
desc: 'Disable a command group',
aliases: ['disable', 'dg'],
usage: '<prefix>disablegroup <group>',
extraHelp: 'Disables a command group so that all of the commands in the group cannot be used on this server.',
info: 'Disables a command group so that all of the commands in the group cannot be used on this server.',
callerPermissions: ['ADMINISTRATOR']
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/command/base/groupcontrol/EnableGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ export default class extends Command
{
super({
name: 'enablegroup',
description: 'Enable a command group',
desc: 'Enable a command group',
aliases: ['enable', 'eg'],
usage: '<prefix>enablegroup <group>',
extraHelp: 'Enables a command group so that all of the commands in the group can be used on this server.',
info: 'Enables a command group so that all of the commands in the group can be used on this server.',
callerPermissions: ['ADMINISTRATOR']
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/command/base/groupcontrol/Limit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ export default class extends Command
{
super({
name: 'limit',
description: 'Limit a command to the provided roles',
desc: 'Limit a command to the provided roles',
usage: '<prefix>limit <command>, <role names, ...>',
extraHelp: 'The comma after the command name -- before the role names list -- is necessary.',
info: 'The comma after the command name -- before the role names list -- is necessary.',
argOpts: { separator: ',' },
callerPermissions: ['ADMINISTRATOR']
});
Expand Down
4 changes: 2 additions & 2 deletions src/command/base/groupcontrol/ListGroups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ export default class extends Command
{
super({
name: 'listgroups',
description: 'List all command groups and their status',
desc: 'List all command groups and their status',
aliases: ['lg'],
usage: '<prefix>listgroups',
extraHelp: `A '*' denotes a disabled group when listing all command groups.`,
info: `A '*' denotes a disabled group when listing all command groups.`,
callerPermissions: ['ADMINISTRATOR']
});
}
Expand Down
8 changes: 4 additions & 4 deletions src/types/CommandInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
* @typedef {Object} CommandInfo - Object containing required {@link Command} properties
* to be passed to a Command on construction
* @property {string} name See: {@link Command#name}
* @property {string} description See: {@link Command#description}
* @property {string} desc See: {@link Command#desc}
* @property {string} usage See: {@link Command#usage}
* @property {string} [extraHelp] See: {@link Command#extraHelp}
* @property {string} [info] See: {@link Command#info}
* @property {string} [group='base'] See: {@link Command#group}
* @property {string[]} [aliases=[]] See: {@link Command#aliases}
* @property {boolean} [guildOnly=false] See: {@link Command#guildOnly}
Expand All @@ -24,10 +24,10 @@ import { ArgOpts } from './ArgOpts';

export type CommandInfo = {
name: string;
description: string;
desc: string;
usage: string;
group?: string;
extraHelp?: string;
info?: string;
aliases?: string[];
guildOnly?: boolean;
hidden?: boolean;
Expand Down

0 comments on commit 721d8ad

Please sign in to comment.