-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add `choices` and `help` to Command args - `choices` will compare the parsed arg value to itself - `help` will replace any kind of error message produced while parsing the arg or while comparing the arg in `choices` -> `:error` is replaced with the error message inside of the string -> `{help: 'Some error occured: :error'}`, `:error` will be replaced with the actual error message (like if it failed to parse to a number) - Replace `Command.args` with `Command.argParser` and add a setter to set via `Command.args = [arg, arg]` - Add a bunch of `setX` commands to the Command object * Add positional arg support and `required` parameter * Update package.json * Add link escaping to Markup Tools * add typings for `once` and `subscribe` on the main client objects * Fix differences in some objects on update - Fix `guildMemberUpdate` always having `{roles}` in the differences object - `guildMemberUpdate` can have a null `differences`, often, because it might be a user update that was announced via `usersUpdate` - `messageUpdate`, `attachments`, `embeds`, `mentions` should have better checks for being in the differences params - * Update `detritus-utils` version * Fix codestring escaping in the markup tool * Fix `embed.size` not counting author name - Fix `Embed.size` not counting author name - Add `MessageEmbed.size` and `MessageEmbed.length` * apparently forgot to put `mute` on voice states.. * Fix audit log options not parsing into int * Add `_new` properties to guild, overwrite, role * Add `activity` getter to message party invite - Add ability to set prefixes through a setter on the command object * cache subsequent `Command.names` calls * Add some performance fixes to `PRESENCE_UPDATE` handler - No longer diff the entire presence if only `USERS_UPDATE` is being listened to - Don't check `hasDifference` based off activity id since it could be `custom` or `spotify:1` which won't make it unique * Update to version 0.11.1
- Loading branch information
Showing
29 changed files
with
1,855 additions
and
286 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,17 @@ | ||
const { Command } = require('../../lib'); | ||
|
||
|
||
// Use this to have just one class handle all the type errors | ||
class BaseCommand extends Command.Command { | ||
triggerTypingAfter = 1000; | ||
|
||
onTypeError(context, args, errors) { | ||
const description = ['ERRORS']; | ||
for (let key in errors) { | ||
description.push(`**${key}**: ${errors[key].message}`); | ||
} | ||
return context.editOrReply(description.join('\n')); | ||
} | ||
} | ||
|
||
module.exports.BaseCommand = BaseCommand; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,27 @@ | ||
const { BaseCommand } = require('./basecommand'); | ||
|
||
class RollCommand extends BaseCommand { | ||
constructor(client) { | ||
super(client); | ||
this.name = 'roll'; | ||
|
||
// choices will be [1, 2, ..., 20] | ||
this.choices = Array.from({length: 20}).map((v, key) => key 1); | ||
this.default = 1; | ||
this.help = 'Can only roll 1 to 20 times'; | ||
this.label = 'amount'; | ||
this.type = Number; | ||
} | ||
|
||
run(context, args) { | ||
const { amount } = args; | ||
|
||
const rolls = []; | ||
for (let i = 0; i < amount; i ) { | ||
rolls.push(Math.round(Math.random() * 100)); | ||
} | ||
return context.editOrReply(`Rolls: ${rolls.join(', ')}`); | ||
} | ||
} | ||
|
||
module.exports = RollCommand; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,22 @@ | ||
const { BaseCommand } = require('./basecommand'); | ||
|
||
class TagCommand extends BaseCommand { | ||
constructor(client) { | ||
super(client); | ||
this.name = 'tag'; | ||
|
||
// tag <name> <...content>` | ||
// will parse `tag golf cake and eggs` as `{name: 'golf', content: 'cake and eggs'}` | ||
// will parse `tag 'golf cake' and eggs as `{name: 'golf cake', content: 'and eggs'}` | ||
this.type = [ | ||
{label: 'name', help: 'A tag name is required', required: true}, | ||
{label: 'content', consume: true}, | ||
]; | ||
} | ||
|
||
run(context, args) { | ||
return context.editOrReply(`tag \`${args.name}\` with ${(args.content) ? `content as \`${args.content}\`` : 'no content'}`); | ||
} | ||
} | ||
|
||
module.exports = TagCommand; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.