This repository has been archived by the owner on Aug 28, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* initial teams support (#692) * initial teams support * update typings * whoops * whoops v2 * Add Monitor#allowedTypes (#695) Limits messages based on the Message#type * remove client from Piece constructors (#689) * remove client from Piece constructors * typings * Add Monitor#allowedTypes (#695) Limits messages based on the Message#type * Text Prompt Rework (#682) * Text prompt arbitrary user channel (#681) * [wip] maybe * fix target mention * oh right, bots message not theirs * typings: Update for latest commit * fix bad rebase * typings: Fixed missing change in rebase * typings: Remove all instances of GroupDMChannel * Abort the prompt if the user retypes the command (#683) * Abort if command retyped The way this is done properly is to move much of CommandHandler to internals so there isn't a race between monitor/prompter. * fix since docs * fix doc type * fix some order errors * fix typo * minimize impact if original command is edited * typings * make guildSettings not a getter once again * fix crash if you get a message before klasaReady * more optimal crash protection * allow flagSupport to be turned off * seperate argumentError from commandError (#694) * rename event files that have core klasa functionality (#688) * fix bad merge? * fix mentioned bug * add a retries loop for when discord is tripping over cords * typos * fix dm prompt * fix bad error * remove duplicate identifier (#699) * fix(KlasaMessage): reactable not checking READ_MESSAGE_HISTORY permissions * Update Possible.js * typings: Add mentionPrefix on the client * Update Tag.js * ScheduledTask#catchUp is boolean (#712) * src: Fix Store reloading broadcast script * docs: Correct Piece file description It's to the piece's file, not extendables * src: Fix Language creation for loading core languages * typings: Mark Language#store as a LanguageStore * revert(typings): Revert marking of Language#store as LanguageStore * add code for proper teams support dependent on d.js imp (#732) * Update Store.js * add null to usageDelim typings (#750) * add null to usageDelim typings * set eval usage to null to better support pieceDefaults * Update index.d.ts (#744) * Update index.d.ts * Update typings/index.d.ts Co-Authored-By: Antonio Román <[email protected]> * require necessary addditions * update jsdocs * Fix cooldown response (#743) * Update cooldown.js * Update en-US.js * Update en-US.js * Update src/inhibitors/cooldown.js Co-Authored-By: Antonio Román <[email protected]> * Fix(Typing): Add category and subCategory to PieceCommandJSON (#759) * Chore(deps): Bump lodash from 4.17.11 to 4.17.14 (#749) Bumps [lodash](https://github.com/lodash/lodash) from 4.17.11 to 4.17.14. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](lodash/lodash@4.17.11...4.17.14) Signed-off-by: dependabot[bot] <[email protected]> * Add category and subCategory to PieceCommandJSON * fix: Resolved memory leak in Schedule Co-Authored-By: Gryffon Bellish <[email protected]> Thanks Gryffon for finding the bug! * Fix no named types (#741) * Fix no named types * Update src/lib/util/Type.js Co-Authored-By: Hutch <[email protected]> * fix lint * Remove old method (#767) * Fix finalizerError typings (#766) * Fix(Typing): Add string union for EventOptions#emitter (#764) * Fix(Typing): Add string union for EventOptions#emitter * Overcomplicate cause why not :p * remove private message#levelID the command in the inhibitor/finalizer is not necessarily the message.command if for instance it is a reaction command. Therefore, that command has to be taken account for, not the one potentually on message, making levelID useless. Since it's private nobody should be using it, therefore it's not breaking to remove it. * bye bye Command#cooldowns inb4 crying that other pieces don't have types so this is just as bad or worse than "privates in pieces" closes #770 * src: Replace client.shard.id with client.options.shards (#772) * src: Replace client.shard.id with client.options.shards * src: Kyra notice * FIx(Typings): Forgot to import Stopwatch (#773) * Fix commands being re-run on non-command edits * Fix a typo (#776) * Client.use should use the util class (#784) * Cooldown Inhibitor Change Seconds To Formatted String (#763) * Update cooldown.js * Update en-US.js * Update Duration.js * Update cooldown.js * Update cooldown.js * Update Duration.js * Update cooldown.js * Update Duration.js * Update cooldown.js * Update cooldown.js * Update cooldown.js * Update cooldown.js * Update cooldown.js * Update cooldown.js * Update cooldown.js * perf(Timestamp): Increased performance and move patterns to maps (#762) * perf: Avoid megamorphic ICs and increased performance Now everything is monomorphic and can run fully inlined, yay! * docs: Documented Timestamp's static properties * docs: We should switch to TSDocs... * docs: Fixed type and renamed property * Timestamp: Remove `tokenRepeatingCounts` The property has been 👢'd! * Timestamp: Inline all functions * Timestamp: Resolve has+get anti-pattern * Constants: Make TIME.TIMESTAMP.TOKENS a map And removed `tokenRepeatingCounts` from Timestamp to reduce memory footprint * Typings: Updated signature for `ConstantsTime.TIMESTAMP.TOKENS` * fix: Y and YY formats slicing the first two digits instead of the two last If it's 2019, it should output 19, not 20. * typings: include klasaReady (#796) * typings: Added flagSupport to TextPromptOptions * typings: Add overrides from discord.js to klasa send methods (#794) * Revert "Cooldown Inhibitor Change Seconds To Formatted String (#763)" (#835) This reverts commit 2ff196b. * mention prefix should be checked first so a prefix of < doesn't break mention prefixes * Fix(Commands): renamed event and unified end behavior of commands (#865) * Update disable.js * Update enable.js * client.guilds.cache.size (#963) client.guilds.size is undefined in d.js now * d.js managers fix for resolveGuild (#956) Co-authored-by: Gryffon Bellish <[email protected]> Co-authored-by: Antonio Román <[email protected]> Co-authored-by: Vlad Frangu <[email protected]> Co-authored-by: Skillz4Killz <[email protected]> Co-authored-by: Jacz <[email protected]> Co-authored-by: Kolkies <[email protected]> Co-authored-by: Jeroen Claassens <[email protected]> Co-authored-by: Jacz <[email protected]> Co-authored-by: Gryffon Bellish <[email protected]> Co-authored-by: Wingysam <[email protected]> Co-authored-by: Jonathan Ford <[email protected]>
- Loading branch information
1 parent
48e9eed
commit 5ca3467
Showing
46 changed files
with
588 additions
and
462 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
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
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
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
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,9 @@ | ||
const { Event } = require('klasa'); | ||
|
||
module.exports = class extends Event { | ||
|
||
run(message, command, params, error) { | ||
message.sendMessage(error).catch(err => this.client.emit('wtf', err)); | ||
} | ||
|
||
}; |
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
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
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
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
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 |
---|---|---|
@@ -1,15 +1,29 @@ | ||
const { Finalizer } = require('klasa'); | ||
const { Finalizer, RateLimitManager } = require('klasa'); | ||
|
||
module.exports = class extends Finalizer { | ||
|
||
constructor(...args) { | ||
super(...args); | ||
this.cooldowns = new WeakMap(); | ||
} | ||
|
||
run(message, command) { | ||
if (command.cooldown <= 0 || message.author === this.client.owner) return; | ||
if (command.cooldown <= 0 || this.client.owners.has(message.author)) return; | ||
|
||
try { | ||
command.cooldowns.acquire(message.levelID).drip(); | ||
this.getCooldown(message, command).drip(); | ||
} catch (err) { | ||
this.client.emit('error', `${message.author.username}[${message.author.id}] has exceeded the RateLimit for ${message.command}`); | ||
} | ||
} | ||
|
||
getCooldown(message, command) { | ||
let cooldownManager = this.cooldowns.get(command); | ||
if (!cooldownManager) { | ||
cooldownManager = new RateLimitManager(command.bucket, command.cooldown * 1000); | ||
this.cooldowns.set(command, cooldownManager); | ||
} | ||
return cooldownManager.acquire(message.guild ? message[command.cooldownLevel].id : message.author.id); | ||
} | ||
|
||
}; |
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
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.