diff --git a/src/commands/duel.ts b/src/commands/duel.ts index 7ef1660..485dd70 100644 --- a/src/commands/duel.ts +++ b/src/commands/duel.ts @@ -20,7 +20,7 @@ import { ColorRoles } from './roleCommands/changecolor.js' import { getCallerFromCommand, getGuildAndCallerFromCommand } from '../utils/CommandUtils.js' import { shuffleArray } from '../utils/Helpers.js' -const DUEL_COOLDOWN = 10 * 60 * 1000 // Cooldown period after loss in milliseconds +export const DUEL_COOLDOWN = 10 * 60 * 1000 // Cooldown period after loss in milliseconds const GLOBAL_DUEL_TIMEOUT_DURATION = 5 * 60 * 1000 const NAMED_DUEL_TIMEOUT_DURATION = 3 * 60 * 1000 const DRAW_TIMEOUT_DURATION = 10 * 60 * 1000 @@ -29,7 +29,7 @@ const DRAW_TIMEOUT_DURATION = 10 * 60 * 1000 @SlashGroup({ name: 'duel', description: 'Duel minigame' }) @SlashGroup('duel') @injectable() -export class Duel { +class Duel { private inProgress = false // Time before the duel is declared dead in milliseconds diff --git a/src/commands/roleCommands/changecolor.ts b/src/commands/roleCommands/changecolor.ts index a0c3a96..def2ddd 100644 --- a/src/commands/roleCommands/changecolor.ts +++ b/src/commands/roleCommands/changecolor.ts @@ -21,7 +21,7 @@ import { ORM } from '../../persistence/index.js' import { Prisma } from '../../../prisma/generated/prisma-client-js/index.js' import { IsSuperUser, superUserIds, superUserRoles } from '../../guards/RoleChecks.js' import { getCallerFromCommand, getGuildAndCallerFromCommand, getGuildFromCommand } from '../../utils/CommandUtils.js' -import { Duel } from '../duel.js' +import { DUEL_COOLDOWN } from '../duel.js' import { getTimeLeftInReadableFormat } from '../../utils/CooldownUtils.js' @Discord() @@ -241,10 +241,10 @@ export class ColorRoles { }) if (!superUserIds.some((id) => id.id === member.id)) { - if (userOptions.lastLoss.getTime() + Duel.cooldown > Date.now()) { + if (userOptions.lastLoss.getTime() + DUEL_COOLDOWN > Date.now()) { return `${member.user}, you have recently lost a duel. Please wait ${getTimeLeftInReadableFormat( userOptions.lastLoss, - Duel.cooldown + DUEL_COOLDOWN )} before trying again.` } else if (userOptions.lastRandom.getTime() + ColorRoles.cooldown > Date.now()) { return `${member.user}, you have recently randomed/gambled. Please wait ${getTimeLeftInReadableFormat(