Skip to content

Commit

Permalink
chore(deps): upgrade all (#243)
Browse files Browse the repository at this point in the history
  • Loading branch information
r-priyam authored Nov 23, 2024
1 parent ce3dcce commit 772e8dc
Show file tree
Hide file tree
Showing 40 changed files with 7,088 additions and 3,920 deletions.
14 changes: 0 additions & 14 deletions .eslintrc.json

This file was deleted.

46 changes: 46 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import common from 'eslint-config-neon/common';
import node from 'eslint-config-neon/node';
import prettier from 'eslint-config-neon/prettier';
import typescript from 'eslint-config-neon/typescript';

/**
* @type {import('@typescript-eslint/utils').TSESLint.FlatConfig.ConfigArray}
*/
const config = [
...common,
...node,
...typescript,
{
languageOptions: {
parserOptions: {
project: './tsconfig.eslint.json'
}
},
ignores: ['./dist/*'],
rules: {
'curly': 1,
'tsdoc/syntax': 0,
'jsdoc/newline-after-description': 0,
'@typescript-eslint/sort-type-union-intersection-members': 0,
'@typescript-eslint/consistent-type-definitions': 0,
'unicorn/number-literal-case': 0,
'unicorn/numeric-separators-style': 0,
'unicorn/new-for-builtins': 0,
'import-x/extensions': 0,
'import-x/order': [
2,
{
'alphabetize': {
caseInsensitive: false,
order: 'asc'
},
'groups': ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'type'],
'newlines-between': 'always'
}
]
}
},
...prettier
];

export default config;
80 changes: 40 additions & 40 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"scripts": {
"build": "tsup",
"dev": "tsup --watch --onSuccess \"yarn start\"",
"format": "prettier --write . && eslint src --ext ts --fix --format=pretty",
"lint": "prettier --check . && eslint src --ext ts --format=pretty",
"format": "prettier --write . && eslint src --fix",
"lint": "prettier --check . && eslint src",
"migrate": "node scripts/dbMigration.mjs",
"migrate:new": "ley new $0 --timestamp --esm",
"start": "node --enable-source-maps dist/goblin.js",
Expand All @@ -34,7 +34,7 @@
"lint-staged": {
"*.{mjs,js,ts}": [
"prettier --write --loglevel=warn \"src/**/*.ts\"",
"eslint --fix --ext mjs,js,ts"
"eslint src --fix"
]
},
"config": {
Expand All @@ -47,59 +47,59 @@
},
"dependencies": {
"@ltd/j-toml": "^1.38.0",
"@napi-rs/canvas": "^0.1.52",
"@sapphire/cron": "^1.1.3",
"@sapphire/decorators": "^6.1.0",
"@sapphire/discord.js-utilities": "^7.2.1",
"@sapphire/framework": "5.2.1",
"@napi-rs/canvas": "^0.1.63",
"@sapphire/cron": "^1.2.1",
"@sapphire/decorators": "^6.1.1",
"@sapphire/discord.js-utilities": "^7.3.1",
"@sapphire/framework": "5.3.1",
"@sapphire/plugin-logger": "^4.0.2",
"@sapphire/plugin-scheduled-tasks": "^10.0.1",
"@sapphire/plugin-subcommands": "6.0.3",
"@sapphire/result": "^2.6.6",
"@sapphire/stopwatch": "^1.5.2",
"@sapphire/type": "^2.4.4",
"@sapphire/utilities": "^3.16.2",
"@sentry/node": "7.116.0",
"@sapphire/plugin-scheduled-tasks": "^10.0.2",
"@sapphire/plugin-subcommands": "7.0.1",
"@sapphire/result": "^2.7.2",
"@sapphire/stopwatch": "^1.5.4",
"@sapphire/type": "^2.5.1",
"@sapphire/utilities": "^3.18.1",
"@sentry/node": "8.40.0",
"@skyra/env-utilities": "^1.3.0",
"bufferutil": "^4.0.8",
"bullmq": "^5.7.12",
"clashofclans.js": "^3.3.10",
"bullmq": "^5.29.1",
"clashofclans.js": "^3.3.16",
"colorette": "^2.0.20",
"discord-api-types": "^0.37.85",
"discord.js": "^14.15.2",
"figlet": "^1.7.0",
"discord-api-types": "^0.37.107",
"discord.js": "^14.16.3",
"figlet": "^1.8.0",
"fuse.js": "^7.0.0",
"gradient-string": "^2.0.2",
"gradient-string": "^3.0.0",
"ioredis": "^5.4.1",
"markdown-table": "^3.0.3",
"nanoid": "^5.0.7",
"postgres": "^3.4.4",
"markdown-table": "^3.0.4",
"nanoid": "^5.0.8",
"postgres": "^3.4.5",
"reflect-metadata": "^0.2.2",
"string-strip-html": "^13.4.8",
"undici": "^6.18.1",
"utf-8-validate": "^6.0.4",
"undici": "^6.21.0",
"utf-8-validate": "^6.0.5",
"zlib-sync": "^0.1.9"
},
"devDependencies": {
"@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2",
"@commitlint/cli": "^19.6.0",
"@commitlint/config-conventional": "^19.6.0",
"@sapphire/prettier-config": "^2.0.0",
"@sapphire/ts-config": "^5.0.1",
"@swc/core": "^1.5.7",
"@types/figlet": "^1.5.8",
"@swc/core": "^1.9.3",
"@types/figlet": "^1.7.0",
"@types/gradient-string": "^1.1.6",
"@types/node": "^20.12.12",
"@typescript-eslint/eslint-plugin": "^7.10.0",
"@typescript-eslint/parser": "^7.10.0",
"@types/node": "^22.9.3",
"@typescript-eslint/eslint-plugin": "^8.15.0",
"@typescript-eslint/parser": "^8.15.0",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8.57.0",
"eslint-config-snail": "^2.0.0",
"eslint-formatter-pretty": "^5.0.0",
"eslint": "^9.15.0",
"eslint-config-neon": "^0.2.3",
"eslint-formatter-pretty": "^6.0.1",
"ley": "^0.8.1",
"lint-staged": "^15.2.5",
"prettier": "^3.2.5",
"tsup": "^8.0.2",
"typescript": "^5.4.5"
"lint-staged": "^15.2.10",
"prettier": "^3.3.3",
"tsup": "^8.3.5",
"typescript": "^5.7.2"
},
"packageManager": "[email protected]",
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/Admin/eval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class EvalCommand extends GoblinCommand {
const { result, success, type, elapsed } = await this.eval(interaction, code, { isAsync, depth });
const output = success ? codeBlock('js', result) : codeBlock('bash', result);

const embedLimitReached = output.length > 4096;
const embedLimitReached = output.length > 4_096;
const embed = new EmbedBuilder()
.setTitle('Info')
.setDescription(embedLimitReached ? 'Output was too long! The result has been sent as a file.' : output)
Expand Down
2 changes: 1 addition & 1 deletion src/commands/Clan/clan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ ${MiscEmotes.Win} ${clan.warWins} Won ${MiscEmotes.Lose} ${clan.warLosses ?? 0}
clan.warTies ?? 0
} Tied
**Win Streak**\n${MiscEmotes.Streak} ${clan.warWinStreak}\n**War Frequency**
${RawWarFrequency[clan.warFrequency]}
${RawWarFrequency[clan.warFrequency ?? 'unknown']}
**War League**
${WarLeagueEmotes[clan.warLeague!.name]} ${clan.warLeague!.name}`,
inline: false
Expand Down
4 changes: 2 additions & 2 deletions src/commands/Misc/about.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export class AboutCommand extends GoblinCommand {
channels: client.channels.cache.size,
guilds: client.guilds.cache.size,
nodeJs: process.version,
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands

users: client.guilds.cache.reduce((acc, val) => acc + (val.memberCount ?? 0), 0),
discordjsVersion: `v${version}`,
clashofclansVersion: `v${dependencies['clashofclans.js']}`
Expand All @@ -108,7 +108,7 @@ export class AboutCommand extends GoblinCommand {

private get uptimeStatistics() {
const now = Date.now();
const nowSeconds = roundNumber(now / 1000);
const nowSeconds = roundNumber(now / 1_000);
return {
client: time(seconds.fromMilliseconds(now - this.container.client.uptime!), TimestampStyles.RelativeTime),
host: time(roundNumber(nowSeconds - uptime()), TimestampStyles.RelativeTime),
Expand Down
2 changes: 1 addition & 1 deletion src/commands/Misc/userInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class UserInfoCommand extends GoblinCommand {
const value = [...roles.values()].join(' ');
embed.addFields({
name: 'Roles',
value: `${value.length > 1024 ? `${value.slice(1, 1020)}...` : value}`,
value: `${value.length > 1_024 ? `${value.slice(1, 1_020)}...` : value}`,
inline: false
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/Player/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class PlayerCommand extends GoblinCommand {
const authorId = interaction.user.id;
const collector = message.channel.createMessageComponentCollector({
componentType: ComponentType.Button,
filter: (interaction) => collectorFiler(interaction, authorId, message.id),
filter: async (interaction) => collectorFiler(interaction, authorId, message.id),
time: Time.Minute * 2
});

Expand Down
4 changes: 3 additions & 1 deletion src/commands/Profile/nickname.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ export class NicknameCommand extends GoblinCommand {
});
}

const playersData = await Util.allSettled(data.map((tags) => this.container.coc.getPlayer(tags.playerTag)));
const playersData = await Util.allSettled(
data.map(async (tags) => this.container.coc.getPlayer(tags.playerTag))
);

if (playersData.length === 1) {
await NicknameCommand.updateNickname(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class ButtonHandler extends InteractionHandler {
...linkedPlayers.map((data) => ({ [data.playerTag]: data.registered }))
);
const playersData = await Util.allSettled(
Object.keys(linkedData).map((tag) => this.container.coc.getPlayer(tag))
Object.keys(linkedData).map(async (tag) => this.container.coc.getPlayer(tag))
);
const players = playersData.filter((player) => player.townHallLevel > 8);

Expand Down
3 changes: 2 additions & 1 deletion src/interaction-handlers/modals/startClanEmbedModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class ModalHandler extends InteractionHandler {
}

public override async parse(interaction: ModalSubmitInteraction) {
if (!interaction.customId.startsWith(ModalCustomIds.StartClanEmbed)) {
if (!interaction.customId.startsWith(ModalCustomIds.StartClanEmbed) || !interaction.channel?.isSendable()) {
return this.none();
}

Expand Down Expand Up @@ -80,6 +80,7 @@ export class ModalHandler extends InteractionHandler {
leaderId: string,
color: string
) {
// @ts-expect-error Sendable channel is checked above
const automationMessage = await interaction.channel!.send({
embeds: [
await this.coc.clanHelper.generateAutomationClanEmbed(clan, {
Expand Down
46 changes: 23 additions & 23 deletions src/lib/coc/constant/emotes.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
export const LeagueEmotes: { [key: number]: string } = {
29000000: '<:Unranked:601618883853680653>',
29000001: '<:BronzeLeagueIII:601611929311510528>',
29000002: '<:BronzeLeagueII:601611942850986014>',
29000003: '<:BronzeLeagueI:601611950228635648>',
29000004: '<:SilverLeagueIII:601611958067920906>',
29000005: '<:SilverLeagueII:601611965550428160>',
29000006: '<:SilverLeagueI:601611974849331222>',
29000007: '<:GoldLeagueIII:601611988992262144>',
29000008: '<:GoldLeagueII:601611996290613249>',
29000009: '<:GoldLeagueI:601612010492526592>',
29000010: '<:CrystalLeagueIII:601612021472952330>',
29000011: '<:CrystalLeagueII:601612033976434698>',
29000012: '<:CrystalLeagueI:601612045359775746>',
29000013: '<:MasterLeagueIII:601612064913621002>',
29000014: '<:MasterLeagueII:601612075474616399>',
29000015: '<:MasterLeagueI:601612085327036436>',
29000016: '<:ChampionLeagueIII:601612099226959892>',
29000017: '<:ChampionLeagueII:601612113345249290>',
29000018: '<:ChampionLeagueI:601612124447440912>',
29000019: '<:TitanLeagueIII:601612137491726374>',
29000020: '<:TitanLeagueII:601612148325744640>',
29000021: '<:TitanLeagueI:601612159327141888>',
29000022: '<:LegendLeague:601612163169255436>'
29_000_000: '<:Unranked:601618883853680653>',
29_000_001: '<:BronzeLeagueIII:601611929311510528>',
29_000_002: '<:BronzeLeagueII:601611942850986014>',
29_000_003: '<:BronzeLeagueI:601611950228635648>',
29_000_004: '<:SilverLeagueIII:601611958067920906>',
29_000_005: '<:SilverLeagueII:601611965550428160>',
29_000_006: '<:SilverLeagueI:601611974849331222>',
29_000_007: '<:GoldLeagueIII:601611988992262144>',
29_000_008: '<:GoldLeagueII:601611996290613249>',
29_000_009: '<:GoldLeagueI:601612010492526592>',
29_000_010: '<:CrystalLeagueIII:601612021472952330>',
29_000_011: '<:CrystalLeagueII:601612033976434698>',
29_000_012: '<:CrystalLeagueI:601612045359775746>',
29_000_013: '<:MasterLeagueIII:601612064913621002>',
29_000_014: '<:MasterLeagueII:601612075474616399>',
29_000_015: '<:MasterLeagueI:601612085327036436>',
29_000_016: '<:ChampionLeagueIII:601612099226959892>',
29_000_017: '<:ChampionLeagueII:601612113345249290>',
29_000_018: '<:ChampionLeagueI:601612124447440912>',
29_000_019: '<:TitanLeagueIII:601612137491726374>',
29_000_020: '<:TitanLeagueII:601612148325744640>',
29_000_021: '<:TitanLeagueI:601612159327141888>',
29_000_022: '<:LegendLeague:601612163169255436>'
};

export const WarLeagueEmotes: { [key: string]: string } = {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/coc/structure/ClanHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { ErrorIdentifiers } from '#utils/constants';
export class ClanHelper {
@ValidateTag({ prefix: 'clan', isDynamic: true })
public async info(_interaction: ChatInputCommandInteraction<'cached'>, tag: string) {
const result = await Result.fromAsync(() => container.coc.getClan(tag));
const result = await Result.fromAsync(async () => container.coc.getClan(tag));
if (result.isErr()) {
const error = result.unwrapErr();
if (error instanceof HTTPError) {
Expand Down Expand Up @@ -93,7 +93,7 @@ ${MiscEmotes.Win} ${clan.warWins} Won ${MiscEmotes.Lose} ${clan.warLosses ?? 0}
clan.warTies ?? 0
} Tied
**Win Streak**\n${MiscEmotes.Streak} ${clan.warWinStreak}\n**War Frequency**
${RawWarFrequency[clan.warFrequency]}
${RawWarFrequency[clan.warFrequency ?? 'unknown']}
**War League**
${WarLeagueEmotes[clan.warLeague!.name]} ${clan.warLeague!.name}`,
inline: false
Expand Down
4 changes: 2 additions & 2 deletions src/lib/coc/structure/LinkApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class LinkApi {

const tagsToFetch = [...new Set([...linkApiTags, ...cachedTags])];
const playersData = await Util.allSettled(
tagsToFetch.slice(0, 5).map((tag) => container.coc.getPlayer(tag))
tagsToFetch.slice(0, 5).map(async (tag) => container.coc.getPlayer(tag))
);

const sqlData = playersData.map((player) => ({
Expand Down Expand Up @@ -75,7 +75,7 @@ export class LinkApi {
return playersData;
}

return Util.allSettled(cachedData.splice(0, 5).map((tag) => container.coc.getPlayer(tag)));
return Util.allSettled(cachedData.splice(0, 5).map(async (tag) => container.coc.getPlayer(tag)));
}

public async createLink(playerTag: string, discordId: string) {
Expand Down
8 changes: 2 additions & 6 deletions src/lib/coc/structure/Player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@ export class GoblinPlayer extends Player {
*/
public units: UnitsHelper;

public constructor(
public override client: GoblinClashClient,
data: APIPlayer
) {
super(client, data);

public constructor(client: GoblinClashClient, data: APIPlayer) {
super(client, data); // Pass `client` and `data` to the base class constructor
this.units = new UnitsHelper(this);
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/coc/structure/PlayerHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { ErrorIdentifiers } from '#utils/constants';
export class PlayerHelper {
@ValidateTag({ prefix: 'player', isDynamic: true })
public async info(_interaction: ChatInputCommandInteraction<'cached'>, tag: string): Promise<GoblinPlayer> {
const result = await Result.fromAsync<GoblinPlayer, HTTPError>(() => container.coc.getPlayer(tag));
const result = await Result.fromAsync<GoblinPlayer, HTTPError>(async () => container.coc.getPlayer(tag));

if (result.isErr()) {
const error = result.unwrapErr();
Expand Down
5 changes: 2 additions & 3 deletions src/lib/decorators/EygInterviewCheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import type { CommandInteraction, GuildMember } from 'discord.js';

import { ErrorIdentifiers } from '#utils/constants';

export const EygInterviewCheck = (): MethodDecorator => {
return createFunctionPrecondition((interaction: CommandInteraction<'cached'>) => {
export const EygInterviewCheck = (): MethodDecorator =>
createFunctionPrecondition((interaction: CommandInteraction<'cached'>) => {
const roleCheck = (interaction.member as GuildMember).roles.cache.hasAny(
envParseString('EYG_RECRUIT_ROLE'),
envParseString('EYG_ADMINISTRATOR_ROLE')
Expand All @@ -22,4 +22,3 @@ export const EygInterviewCheck = (): MethodDecorator => {

return true;
});
};
Loading

0 comments on commit 772e8dc

Please sign in to comment.