Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/commands/duel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/commands/roleCommands/changecolor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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(
Expand Down