-
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added auto-preconditions (#199)
feat(command): added `CommandOptions.nsfw` feat(command): added `CommandOptions.cooldownBucket` feat(command): added `CommandOptions.cooldownDuration` feat(command): added `CommandOptions.runIn` feat(identifiers): added `Identifiers.PreconditionNewsOnly` feat(identifiers): added `Identifiers.PreconditionTextOnly` BREAKING CHANGE: Changed `CommandOptions.preconditions` to always require an array
- Loading branch information
Showing
6 changed files
with
134 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import type { Message } from 'discord.js'; | ||
import { Identifiers } from '../lib/errors/Identifiers'; | ||
import { Precondition, PreconditionResult } from '../lib/structures/Precondition'; | ||
|
||
export class CorePrecondition extends Precondition { | ||
public run(message: Message): PreconditionResult { | ||
return message.channel.type === 'news' | ||
? this.error({ identifier: Identifiers.PreconditionNewsOnly, message: 'You can only run this command in news channels.' }) | ||
: this.ok(); | ||
} | ||
} |
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,11 @@ | ||
import type { Message } from 'discord.js'; | ||
import { Identifiers } from '../lib/errors/Identifiers'; | ||
import { Precondition, PreconditionResult } from '../lib/structures/Precondition'; | ||
|
||
export class CorePrecondition extends Precondition { | ||
public run(message: Message): PreconditionResult { | ||
return message.channel.type === 'text' | ||
? this.error({ identifier: Identifiers.PreconditionTextOnly, message: 'You can only run this command in text channels.' }) | ||
: this.ok(); | ||
} | ||
} |