diff --git a/src/commands/mod/restriction/restrict.ts b/src/commands/mod/restriction/restrict.ts index 0306161..50f9873 100644 --- a/src/commands/mod/restriction/restrict.ts +++ b/src/commands/mod/restriction/restrict.ts @@ -37,7 +37,6 @@ import type { Snowflake, } from 'discord.js'; import IDs from '#utils/ids'; -import { randint } from '#utils/random'; import { addEmptyUser, updateUser, @@ -45,6 +44,7 @@ import { fetchRoles, } from '#utils/database/dbExistingUser'; import { restrict, checkActive } from '#utils/database/restriction'; +import { randint } from '#utils/maths'; export async function restrictRun( userId: Snowflake, diff --git a/src/listeners/verification/leaveVC.ts b/src/listeners/verification/leaveVC.ts index 7f5c581..e110d71 100644 --- a/src/listeners/verification/leaveVC.ts +++ b/src/listeners/verification/leaveVC.ts @@ -25,7 +25,7 @@ import { time, ChannelType, PermissionsBitField } from 'discord.js'; import { maxVCs, leaveBan } from '#utils/verificationConfig'; import { getUser, checkFinish, countIncomplete } from '#utils/database/verification'; import { fetchRoles } from '#utils/database/dbExistingUser'; -import { fibonacci } from '#utils/mathsSeries'; +import { fibonacci } from '#utils/maths'; import IDs from '#utils/ids'; export class VerificationLeaveVCListener extends Listener { diff --git a/src/utils/database/verification.ts b/src/utils/database/verification.ts index 065f555..d1c11e8 100644 --- a/src/utils/database/verification.ts +++ b/src/utils/database/verification.ts @@ -21,7 +21,7 @@ import type { GuildMember } from 'discord.js'; import { container } from '@sapphire/framework'; import { updateUser } from '#utils/database/dbExistingUser'; import { leaveBan } from '#utils/verificationConfig'; -import { fibonacci } from '#utils/mathsSeries'; +import { fibonacci } from '#utils/maths'; export async function joinVerification(channelId: string, user: GuildMember) { // Update the user on the database with the current roles they have diff --git a/src/utils/mathsSeries.ts b/src/utils/maths.ts similarity index 75% rename from src/utils/mathsSeries.ts rename to src/utils/maths.ts index 2a99459..458839c 100644 --- a/src/utils/mathsSeries.ts +++ b/src/utils/maths.ts @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-or-later /* Animal Rights Advocates Discord Bot - Copyright (C) 2022 Anthony Berg + Copyright (C) 2023 Anthony Berg This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,6 +16,15 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +/** + * Creates a (PRNG) random integer between minimum and maximum both inclusive + * @param min minimum integer + * @param max maximum integer + * @returns number a random integer between min and max + */ +export function randint(min: number, max: number) { + return Math.floor(Math.random() * (max - min + 1)) + min; +} // Created because Stove loves Fibonacci sequences // A fibonacci sequence where n = 0 => 1 diff --git a/src/utils/random.ts b/src/utils/random.ts deleted file mode 100644 index d214d7a..0000000 --- a/src/utils/random.ts +++ /dev/null @@ -1,23 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -/* - Animal Rights Advocates Discord Bot - Copyright (C) 2023 Anthony Berg - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -// Random integer between min and max -export function randint(min: number, max: number) { - return Math.floor(Math.random() * (max - min + 1)) + min; -}