Skip to content

Commit

Permalink
Update all dependencies, switch module type to ESNext
Browse files Browse the repository at this point in the history
  • Loading branch information
mmerfort committed Jul 14, 2024
1 parent 9f090be commit caabaa1
Show file tree
Hide file tree
Showing 24 changed files with 3,162 additions and 3,535 deletions.
6,541 changes: 3,084 additions & 3,457 deletions package-lock.json

Large diffs are not rendered by default.

56 changes: 28 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,42 +22,42 @@
"url": "https://github.com/Brexbot/DiscordBot/issues"
},
"homepage": "https://github.com/Brexbot/DiscordBot#readme",
"type": "commonjs",
"type": "module",
"devDependencies": {
"@types/cron": "^2.0.1",
"@types/node": "^18.15.10",
"@types/node-fetch": "^2.6.2",
"@typescript-eslint/eslint-plugin": "^5.57.0",
"@typescript-eslint/parser": "^5.57.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^4.2.1",
"nodemon": "^2.0.22",
"prettier": "^2.8.7",
"rimraf": "^4.4.1",
"ts-node": "^10.9.1",
"tslib": "^2.5.0",
"typescript": "^5.0.2"
"@types/node": "^20.14.10",
"@types/node-fetch": "^2.6.11",
"@typescript-eslint/eslint-plugin": "^7.16.0",
"@typescript-eslint/parser": "^7.16.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"nodemon": "^3.1.4",
"prettier": "^3.3.3",
"rimraf": "^6.0.1",
"ts-node": "^10.9.2",
"tslib": "^2.6.3",
"typescript": "^5.5.3"
},
"dependencies": {
"@dice-roller/rpg-dice-roller": "^5.2.1",
"@discordx/importer": "^1.2.1",
"@discordx/pagination": "^3.4.1",
"@discordx/utilities": "^5.2.1",
"@prisma/client": "^4.12.0",
"@twurple/api": "^6.0.9",
"@twurple/auth": "^6.0.9",
"@dice-roller/rpg-dice-roller": "^5.5.0",
"@discordx/importer": "^1.3.1",
"@discordx/pagination": "^3.5.4",
"@discordx/utilities": "^7.0.1",
"@prisma/client": "^5.16.2",
"@twurple/api": "^7.1.0",
"@twurple/auth": "^7.1.0",
"@types/sharp": "^0.31.1",
"cron": "^2.3.0",
"discord-api-types": "^0.37.37",
"discord.js": "^14.8.0",
"discordx": "^11.7.4",
"cron": "^3.1.7",
"discord-api-types": "^0.37.92",
"discord.js": "^14.15.3",
"discordx": "^11.12.0",
"fs": "^0.0.1-security",
"hsl-rgb": "^1.0.0",
"localisetimemodule": "github:QOAL/localiseTimeModule#20230503",
"path": "^0.12.7",
"prisma": "^4.12.0",
"reflect-metadata": "^0.1.13",
"sharp": "^0.32.0",
"sponge-case": "^1.0.1"
"prisma": "^5.16.2",
"reflect-metadata": "^0.2.2",
"sharp": "^0.33.4",
"sponge-case": "^2.0.3"
}
}
8 changes: 4 additions & 4 deletions src/commands/NFD.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import {
userMention,
} from 'discord.js'
import { Discord, Guard, Slash, SlashChoice, SlashGroup, SlashOption } from 'discordx'
import { getCallerFromCommand, getNicknameFromUser } from '../utils/CommandUtils'
import { getCallerFromCommand, getNicknameFromUser } from '../utils/CommandUtils.js'
import { injectable } from 'tsyringe'
import { ORM } from '../persistence'
import { NFDItem } from '../../prisma/generated/prisma-client-js'
import { IsSuperUser } from '../guards/RoleChecks'
import { ORM } from '../persistence/ORM.js'
import { NFDItem } from '../../prisma/generated/prisma-client-js/index.js'
import { IsSuperUser } from '../guards/RoleChecks.js'
import sharp from 'sharp'

type BodyParts = {
Expand Down
4 changes: 2 additions & 2 deletions src/commands/RPG/Character.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { adjectives, nouns, CharacterClass, classes, CharacterSpecie, species } from './Data'
import { getSeededRandomElement, rollSeeded_dy_x_TimesPick_z, mulberry32, cyrb53 } from './util'
import { adjectives, nouns, CharacterClass, classes, CharacterSpecie, species } from './Data.js'
import { getSeededRandomElement, rollSeeded_dy_x_TimesPick_z, mulberry32, cyrb53 } from './util.js'
import { EmbedBuilder, User } from 'discord.js'

export class Character {
Expand Down
8 changes: 4 additions & 4 deletions src/commands/RPG/RPG.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Character } from './Character'
import { getEloRankChange, getRandomElement as getRandomElement, roll_dy_x_TimesPick_z } from './util'
import { attackTexts, defenceFailureTexts, defenceSuccessTexts, ladderTexts, victoryTexts } from './Dialogue'
import { ELO_K } from './Data'
import { Character } from './Character.js'
import { getEloRankChange, getRandomElement as getRandomElement, roll_dy_x_TimesPick_z } from './util.js'
import { attackTexts, defenceFailureTexts, defenceSuccessTexts, ladderTexts, victoryTexts } from './Dialogue.js'
import { ELO_K } from './Data.js'

import {
ActionRowBuilder,
Expand Down
2 changes: 1 addition & 1 deletion src/commands/RPG/util.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { classes } from './Data'
import { classes } from './Data.js'

export function cyrb53(str: string, seed = 0): number {
// Hash the input string to int
Expand Down
2 changes: 1 addition & 1 deletion src/commands/chatters/artemis.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Discord, SimpleCommand, SimpleCommandMessage, SimpleCommandOption, SimpleCommandOptionType } from 'discordx'
import { shuffleArray } from '../../utils/Helpers'
import { shuffleArray } from '../../utils/Helpers.js'

@Discord()
class Artemis {
Expand Down
12 changes: 6 additions & 6 deletions src/commands/duel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import {
} from 'discord.js'
import { Discord, Slash, SlashGroup } from 'discordx'
import { injectable } from 'tsyringe'
import { ORM } from '../persistence/ORM'
import { ORM } from '../persistence/ORM.js'

import { Duels } from '../../prisma/generated/prisma-client-js'
import { ColorRoles } from './roleCommands/changecolor'
import { getCallerFromCommand, getGuildAndCallerFromCommand } from '../utils/CommandUtils'
import { getGlobalDuelCDRemaining, getTimeLeftInReadableFormat } from '../utils/CooldownUtils'
import { shuffleArray } from '../utils/Helpers'
import { Duels } from '../../prisma/generated/prisma-client-js/index.js'
import { ColorRoles } from './roleCommands/changecolor.js'
import { getCallerFromCommand, getGuildAndCallerFromCommand } from '../utils/CommandUtils.js'
import { getGlobalDuelCDRemaining, getTimeLeftInReadableFormat } from '../utils/CooldownUtils.js'
import { shuffleArray } from '../utils/Helpers.js'

@Discord()
@SlashGroup({ name: 'duel', description: 'Duel minigame' })
Expand Down
6 changes: 3 additions & 3 deletions src/commands/mixu.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { CommandInteraction, Guild } from 'discord.js'
import { Discord, SimpleCommand, SimpleCommandMessage, Slash } from 'discordx'
import { injectable } from 'tsyringe'
import { ORM } from '../persistence'
import { BestMixu } from '../../prisma/generated/prisma-client-js'
import { shuffleArray } from '../utils/Helpers'
import { ORM } from '../persistence/ORM.js'
import { BestMixu } from '../../prisma/generated/prisma-client-js/index.js'
import { shuffleArray } from '../utils/Helpers.js'

@Discord()
@injectable()
Expand Down
4 changes: 2 additions & 2 deletions src/commands/modCommands/Pardon.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Client, Discord, Guard, SimpleCommand, SimpleCommandMessage } from 'discordx'
import { GuildMember } from 'discord.js'
import { injectable } from 'tsyringe'
import { ORM } from '../../persistence'
import { IsSuperUser } from '../../guards/RoleChecks'
import { ORM } from '../../persistence/index.js'
import { IsSuperUser } from '../../guards/RoleChecks.js'

@Discord()
@injectable()
Expand Down
2 changes: 1 addition & 1 deletion src/commands/modCommands/releasetheeggplant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
SimpleCommandOption,
SimpleCommandOptionType,
} from 'discordx'
import { IsSuperUser, memberIsSU } from '../../guards/RoleChecks'
import { IsSuperUser, memberIsSU } from '../../guards/RoleChecks.js'

@Discord()
@Guard(IsSuperUser)
Expand Down
4 changes: 2 additions & 2 deletions src/commands/modCommands/setgamble.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import {
SimpleCommandOption,
SimpleCommandOptionType,
} from 'discordx'
import { Prisma } from '../../../prisma/generated/prisma-client-js'
import { Prisma } from '../../../prisma/generated/prisma-client-js/index.js'
import { injectable } from 'tsyringe'
import { ORM } from '../../persistence'
import { IsSuperUser } from '../../guards/RoleChecks'
import { IsSuperUser } from '../../guards/RoleChecks.js'

@Discord()
@injectable()
Expand Down
2 changes: 1 addition & 1 deletion src/commands/quote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
Slash,
SlashOption,
} from 'discordx'
import { uwuify } from './uwu'
import { uwuify } from './uwu.js'

interface Quote {
id: number
Expand Down
10 changes: 5 additions & 5 deletions src/commands/roleCommands/changecolor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ import {
HexColorString,
} from 'discord.js'
import { injectable } from 'tsyringe'
import { ORM } from '../../persistence'
import { Prisma } from '../../../prisma/generated/prisma-client-js'
import { ORM } from '../../persistence/index.js'
import { Prisma } from '../../../prisma/generated/prisma-client-js/index.js'
import { IsSuperUser, superUserIds, superUserRoles } from '../../guards/RoleChecks'
import { getCallerFromCommand, getGuildAndCallerFromCommand, getGuildFromCommand } from '../../utils/CommandUtils'
import { Duel } from '../duel'
import { getTimeLeftInReadableFormat } from '../../utils/CooldownUtils'
import { getCallerFromCommand, getGuildAndCallerFromCommand, getGuildFromCommand } from '../../utils/CommandUtils.js'
import { Duel } from '../duel.js'
import { getTimeLeftInReadableFormat } from '../../utils/CooldownUtils.js'

@Discord()
@injectable()
Expand Down
2 changes: 1 addition & 1 deletion src/commands/roleCommands/embedpls.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Discord, SimpleCommand, SimpleCommandMessage, Slash, SlashOption } from 'discordx'
import { ApplicationCommandOptionType, CommandInteraction, GuildMember, GuildMemberRoleManager, User } from 'discord.js'
import { memberIsSU } from '../../guards/RoleChecks'
import { memberIsSU } from '../../guards/RoleChecks.js'

// Intentionally leaving out the slash command for this as it doesn't really make sense to
// clutter the slash menu with a command that most users will only ever use once
Expand Down
2 changes: 1 addition & 1 deletion src/commands/roleCommands/icon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
SlashOption,
} from 'discordx'
import { ApplicationCommandOptionType, CommandInteraction, GuildMemberRoleManager, RoleManager } from 'discord.js'
import { IsSuperUser } from '../../guards/RoleChecks'
import { IsSuperUser } from '../../guards/RoleChecks.js'

@Discord()
class Icon {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/roleCommands/rolesub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
SlashOption,
} from 'discordx'
import { ApplicationCommandOptionType, CommandInteraction, GuildMemberRoleManager, RoleManager } from 'discord.js'
import { IsSuperUser } from '../../guards/RoleChecks'
import { IsSuperUser } from '../../guards/RoleChecks.js'

@Discord()
class Rolesub {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/roll.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DiceRoll } from '@dice-roller/rpg-dice-roller'
import { ApplicationCommandOptionType, CommandInteraction } from 'discord.js'
import { Discord, Slash, SlashGroup, SlashOption } from 'discordx'
import { getRandomElement } from './RPG/util'
import { getRandomElement } from './RPG/util.js'

@SlashGroup({ name: 'roll', description: 'Ask the dice for advice' })
@SlashGroup('roll')
Expand Down
2 changes: 1 addition & 1 deletion src/commands/rps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
MessageActionRowComponentBuilder,
} from 'discord.js'
import { Discord, Slash } from 'discordx'
import { getCallerFromCommand } from '../utils/CommandUtils'
import { getCallerFromCommand } from '../utils/CommandUtils.js'

type RPSChoice = 'rock' | 'paper' | 'scissors'

Expand Down
2 changes: 1 addition & 1 deletion src/commands/timeout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
Slash,
SlashOption,
} from 'discordx'
import { IsSuperUser, memberIsSU } from '../guards/RoleChecks'
import { IsSuperUser, memberIsSU } from '../guards/RoleChecks.js'

@Discord()
abstract class Timeout {
Expand Down
12 changes: 6 additions & 6 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import type { Interaction, Message } from 'discord.js'
import { GatewayIntentBits, IntentsBitField } from 'discord.js'
import { Client, DIService, tsyringeDependencyRegistryEngine } from 'discordx'
import { container } from 'tsyringe'
import { importx } from '@discordx/importer'
import { NotBot } from './guards/RoleChecks'
import { NoWhitespace } from './guards/NoWhitespace'
import { dirname, importx } from '@discordx/importer'
import { NotBot } from './guards/RoleChecks.js'
import { NoWhitespace } from './guards/NoWhitespace.js'
import { isPromise } from 'util/types'
import { CronJob } from 'cron'
import { clearOrphanedRoles } from './standalones/clearOrphanedRoles'
import { decayElo } from './standalones/eloDecay'
import { clearOrphanedRoles } from './standalones/clearOrphanedRoles.js'
import { decayElo } from './standalones/eloDecay.js'

// eslint-disable-next-line @typescript-eslint/no-explicit-any
;(BigInt.prototype as any).toJSON = function () {
Expand Down Expand Up @@ -115,7 +115,7 @@ bot.on('messageCreate', (message: Message) => {
async function run() {
DIService.engine = tsyringeDependencyRegistryEngine.setInjector(container)

await importx(`${__dirname}/{events,commands,persistence}/**/*.{ts,js}`)
await importx(`${dirname}/{events,commands,persistence}/**/*.{ts,js}`)
bot.login(process.env.DISCORD_TOKEN ?? '') // provide your bot token
}

Expand Down
2 changes: 1 addition & 1 deletion src/persistence/ORM.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PrismaClient } from '../../prisma/generated/prisma-client-js'
import { PrismaClient } from '../../prisma/generated/prisma-client-js/index.js'
import { singleton } from 'tsyringe'

@singleton()
Expand Down
6 changes: 3 additions & 3 deletions src/standalones/eloDecay.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PrismaClient, RPGCharacter } from '../../prisma/generated/prisma-client-js'
import { ELO_DECAY_FACTOR } from '../commands/RPG/Data'
import { getRandomElement } from '../commands/RPG/util'
import { PrismaClient, RPGCharacter } from '../../prisma/generated/prisma-client-js/index.js'
import { ELO_DECAY_FACTOR } from '../commands/RPG/Data.js'
import { getRandomElement } from '../commands/RPG/util.js'

function calculateEloDecay(eloRank: number): number {
// Linear interpolation between eloRank and 1000 which is the mean ladder "skill"
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"module": "CommonJS",
"module": "ESNext",
"target": "ESNext",
"noImplicitAny": true,
"sourceMap": true,
Expand All @@ -11,7 +11,7 @@
"declaration": false,
"importHelpers": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"moduleResolution": "Bundler",
"esModuleInterop": true,
"skipLibCheck": true,
"types": [
Expand Down

0 comments on commit caabaa1

Please sign in to comment.