Skip to content

Commit

Permalink
feat: add disable cooldown feature
Browse files Browse the repository at this point in the history
Signed-off-by: Hanif Dwy Putra S <[email protected]>
  • Loading branch information
hansputera committed Jan 28, 2023
1 parent b5a0b94 commit 7c9cdba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/@typings/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export interface ClientOptions {
cooldown?: MiddlewareFunc;
};
logger?: pino.LoggerOptions;
disableCooldown?: boolean;
}

export type CollectorEventState = 'create' | 'end';
Expand Down
4 changes: 4 additions & 0 deletions src/middlewares/botCommand.cooldown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ export const botCommandCooldown = async (
context: Context,
cmd: Command,
): Promise<void> => {
if (context.client.getOptions()?.disableCooldown) {
return;
}

const cooldownKey = 'cooldown_'.concat(
context.getCurrentJid(),
'-',
Expand Down

0 comments on commit 7c9cdba

Please sign in to comment.