Skip to content

Commit b86f02b

Browse files
committed
chore: upgrade packages and improve logging
1 parent d0e2117 commit b86f02b

18 files changed

+981
-728
lines changed

package-lock.json

Lines changed: 795 additions & 654 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fightcore.bot",
3-
"version": "2.5.4",
3+
"version": "2.5.5",
44
"description": "FightCore Discord bot to display frame data",
55
"main": "index.js",
66
"scripts": {
@@ -26,26 +26,26 @@
2626
},
2727
"homepage": "https://github.com/FightCore/bot-js#readme",
2828
"dependencies": {
29-
"@apollo/client": "^3.12.4",
29+
"@apollo/client": "^3.14.0",
3030
"@datalust/winston-seq": "^2.0.0",
31-
"@elastic/elasticsearch": "^8.17.0",
32-
"axios": "^1.7.9",
33-
"discord.js": "^14.17.2",
34-
"dotenv": "^16.4.7",
35-
"inversify": "^6.2.1",
31+
"@elastic/elasticsearch": "^8.19.1",
32+
"axios": "^1.13.2",
33+
"discord.js": "^14.25.1",
34+
"dotenv": "^16.6.1",
35+
"inversify": "^6.2.2",
3636
"jaro-winkler-typescript": "^1.0.1",
3737
"reflect-metadata": "^0.2.2",
3838
"sqlite3": "^5.1.7",
39-
"winston": "^3.17.0"
39+
"winston": "^3.19.0"
4040
},
4141
"devDependencies": {
4242
"@jest/globals": "^29.7.0",
43-
"@types/node": "^16.18.123",
43+
"@types/node": "^16.18.126",
4444
"@typescript-eslint/eslint-plugin": "^6.21.0",
4545
"@typescript-eslint/parser": "^6.21.0",
4646
"eslint": "^8.57.1",
4747
"jest": "^29.7.0",
48-
"ts-jest": "^29.2.5",
49-
"typescript": "^5.7.2"
48+
"ts-jest": "^29.4.6",
49+
"typescript": "^5.9.3"
5050
}
51-
}
51+
}

src/assets/framedata.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/assets/moves.json

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,28 @@
1717
"tip"
1818
]
1919
},
20+
{
21+
"move": "ftechroll",
22+
"alias": [
23+
"techin",
24+
"techforward",
25+
"techforwards",
26+
"forwardtech",
27+
"forwardstech"
28+
]
29+
},
30+
{
31+
"move": "btechroll",
32+
"alias": [
33+
"techout",
34+
"techbackward",
35+
"techbackwards",
36+
"backwardtech",
37+
"backwardstech",
38+
"backtech",
39+
"techback"
40+
]
41+
},
2042
{
2143
"move": "fsmash",
2244
"alias": [
@@ -32,13 +54,17 @@
3254
{
3355
"move": "dowmb",
3456
"alias": [
35-
"downspecial"
57+
"downspecial",
58+
"db"
3659
]
3760
},
3861
{
3962
"move": "upb",
4063
"alias": [
41-
"upspecial"
64+
"upspecial",
65+
"uspecial",
66+
"ub",
67+
"groundedupb"
4268
]
4369
},
4470
{
@@ -65,7 +91,8 @@
6591
{
6692
"move": "grab",
6793
"alias": [
68-
"shieldgrab"
94+
"shieldgrab",
95+
"standinggrab"
6996
]
7097
},
7198
{
@@ -111,5 +138,14 @@
111138
"getupstomach",
112139
"attackstomach"
113140
]
141+
},
142+
{
143+
"move": "rjab",
144+
"alias": [
145+
"jabs",
146+
"jabcombo",
147+
"combojab",
148+
"multijab"
149+
]
114150
}
115151
]

src/assets/names.json

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
{
33
"name": "Bowser",
44
"names": [
5-
"bowser"
5+
"bowser",
6+
"koopa"
67
],
78
"fightCoreId": 241
89
},
@@ -60,7 +61,8 @@
6061
"shine": "downb",
6162
"aerialblaster": "aneutralb",
6263
"aeriallaser": "aneutralb",
63-
"drill": "dair"
64+
"drill": "dair",
65+
"illusion": "sideb"
6466
},
6567
"fightCoreId": 218
6668
},
@@ -75,7 +77,8 @@
7577
"laser": "neutralb",
7678
"aerialblaster": "aneutralb",
7779
"aeriallaser": "aneutralb",
78-
"drill": "dair"
80+
"drill": "dair",
81+
"phantasm": "sideb"
7982
}
8083
},
8184
{
@@ -110,7 +113,10 @@
110113
"rondoudou",
111114
"pummeluff"
112115
],
113-
"fightCoreId": 214
116+
"fightCoreId": 214,
117+
"moves": {
118+
"drill": "dair"
119+
}
114120
},
115121
{
116122
"name": "Kirby",
@@ -134,7 +140,10 @@
134140
"link"
135141
],
136142
"moves": {
137-
"tether": "zair"
143+
"tether": "zair",
144+
"arrow": "neutralb",
145+
"boomerang": "sideb",
146+
"bomb": "downb"
138147
},
139148
"fightCoreId": 238
140149
},
@@ -178,6 +187,7 @@
178187
"gamenwatch",
179188
"g&w",
180189
"gnw",
190+
"gmw",
181191
"gw"
182192
],
183193
"moves": {
@@ -198,7 +208,8 @@
198208
"pichu"
199209
],
200210
"moves": {
201-
"jolt": "neutralb"
211+
"jolt": "neutralb",
212+
"lightning": "downb"
202213
},
203214
"fightCoreId": 221
204215
},
@@ -209,7 +220,8 @@
209220
"pika"
210221
],
211222
"moves": {
212-
"jolt": "neutralb"
223+
"jolt": "neutralb",
224+
"lightning": "downb"
213225
},
214226
"fightCoreId": 237
215227
},
@@ -237,6 +249,9 @@
237249
"names": [
238250
"roy"
239251
],
252+
"moves": {
253+
"parry": "downb"
254+
},
240255
"fightCoreId": 223
241256
},
242257
{
@@ -278,7 +293,10 @@
278293
"young"
279294
],
280295
"moves": {
281-
"hookshot": "zair"
296+
"hookshot": "zair",
297+
"arrow": "neutralb",
298+
"boomerang": "sideb",
299+
"bomb": "downb"
282300
},
283301
"fightCoreId": 220
284302
},

src/commands/character-command.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { injectable } from 'inversify';
22
import { Command } from './command';
3-
import { SlashCommandBuilder, CommandInteraction, CacheType } from 'discord.js';
3+
import { SlashCommandBuilder, CacheType, ChatInputCommandInteraction } from 'discord.js';
44
import { Search } from '../data/search';
55
import { CharacterEmbedCreator } from '../embeds/character-embed-creator';
66

@@ -20,7 +20,7 @@ export class CharacterCommand implements Command {
2020
);
2121
return [builder];
2222
}
23-
async handleCommand(interaction: CommandInteraction<CacheType>): Promise<void> {
23+
async handleCommand(interaction: ChatInputCommandInteraction<CacheType>): Promise<void> {
2424
const character = interaction.options.get('character', true).value as string;
2525

2626
const characterSearch = this.search.search(character);

src/commands/frame-data-command.ts

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
import { SlashCommandBuilder, CommandInteraction, CacheType, InteractionResponse } from 'discord.js';
1+
import { SlashCommandBuilder, CacheType, InteractionResponse, ChatInputCommandInteraction } from 'discord.js';
22
import { Command } from './command';
33
import { inject, injectable } from 'inversify';
4-
import { Logger } from 'winston';
5-
import { Symbols } from '../config/symbols';
64
import { FailureStore } from '../data/failure-store';
75
import { Loader } from '../data/loader';
86
import { Search } from '../data/search';
@@ -11,15 +9,11 @@ import { NotFoundEmbedCreator } from '../embeds/not-found-embed-creator';
119
import { SearchResult } from '../models/search/search-result';
1210
import { SearchResultType } from '../models/search/search-result-type';
1311
import { MessageCleaner } from '../utils/message-cleaner';
12+
import { LogSingleton } from '../utils/logs-singleton';
1413

1514
@injectable()
1615
export class FrameDataCommand implements Command {
17-
constructor(
18-
private search: Search,
19-
@inject(Symbols.Logger) private logger: Logger,
20-
private failureStore: FailureStore,
21-
@inject(Loader) private loader: Loader
22-
) {}
16+
constructor(private search: Search, private failureStore: FailureStore, @inject(Loader) private loader: Loader) {}
2317
get commandNames(): string[] {
2418
return ['framedata'];
2519
}
@@ -36,15 +30,16 @@ export class FrameDataCommand implements Command {
3630
);
3731
return [builder];
3832
}
39-
async handleCommand(interaction: CommandInteraction<CacheType>): Promise<void> {
33+
async handleCommand(interaction: ChatInputCommandInteraction<CacheType>): Promise<void> {
34+
const logger = LogSingleton.createContextLogger(interaction);
4035
const searchResult = await this.getSearchResultOrNull(interaction);
4136

4237
if (!searchResult) {
4338
return;
4439
}
4540

4641
const embedCreator = new MoveEmbedCreator(searchResult.move, searchResult.character);
47-
this.logger.info(`Replying with {character} and {move}`, {
42+
logger.info(`Replying with {character} and {move}`, {
4843
character: searchResult.character.name,
4944
move: searchResult.move.name,
5045
});
@@ -55,17 +50,18 @@ export class FrameDataCommand implements Command {
5550
}
5651

5752
private sendNoMoveFoundErrorToInteraction(
58-
interaction: CommandInteraction,
53+
interaction: ChatInputCommandInteraction,
5954
content: string,
6055
searchResult: SearchResult
6156
): Promise<InteractionResponse> {
57+
const logger = LogSingleton.createContextLogger(interaction);
6258
if (content.length > 75) {
6359
content = content.substring(0, 75) + '...';
6460
}
6561

6662
content = MessageCleaner.removeIllegalCharacters(content);
6763

68-
this.logger.warn(`No character or move found for "{content}"`, { content });
64+
logger.warn(`No character or move found for "{content}"`, { content });
6965
const embeds =
7066
searchResult.type === SearchResultType.MoveNotFound
7167
? NotFoundEmbedCreator.createMoveNotFoundEmbed(searchResult.character, content)
@@ -74,7 +70,7 @@ export class FrameDataCommand implements Command {
7470
return interaction.reply({ embeds });
7571
}
7672

77-
private async getSearchResultOrNull(interaction: CommandInteraction): Promise<SearchResult | null> {
73+
private async getSearchResultOrNull(interaction: ChatInputCommandInteraction): Promise<SearchResult | null> {
7874
const character = interaction.options.get('character', true).value;
7975
const move = interaction.options.get('move', true).value;
8076

src/commands/knockback-command.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { SlashCommandBuilder, CommandInteraction, CacheType, InteractionResponse } from 'discord.js';
1+
import { SlashCommandBuilder, CacheType, InteractionResponse, ChatInputCommandInteraction } from 'discord.js';
22
import { Command } from './command';
33
import { inject, injectable } from 'inversify';
44
import { Logger } from 'winston';
@@ -37,7 +37,7 @@ export abstract class KnockbackCommand implements Command {
3737
});
3838
}
3939

40-
async handleCommand(interaction: CommandInteraction<CacheType>): Promise<void> {
40+
async handleCommand(interaction: ChatInputCommandInteraction<CacheType>): Promise<void> {
4141
const searchResult = await this.getSearchResultOrNull(interaction);
4242

4343
if (!searchResult) {
@@ -71,7 +71,7 @@ export abstract class KnockbackCommand implements Command {
7171
}
7272

7373
private sendNoMoveFoundErrorToInteraction(
74-
interaction: CommandInteraction,
74+
interaction: ChatInputCommandInteraction,
7575
content: string,
7676
searchResult: SearchResult
7777
): Promise<InteractionResponse> {
@@ -90,7 +90,7 @@ export abstract class KnockbackCommand implements Command {
9090
return interaction.reply({ embeds });
9191
}
9292

93-
private async getSearchResultOrNull(interaction: CommandInteraction): Promise<SearchResult | null> {
93+
private async getSearchResultOrNull(interaction: ChatInputCommandInteraction): Promise<SearchResult | null> {
9494
const character = interaction.options.get('character', true).value;
9595
const move = interaction.options.get('move', true).value;
9696

src/data/loader.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ export class Loader {
3131
throw new Error('Request has failed, non 200 status code');
3232
}
3333
this.characters = result.data;
34+
if (!Array.isArray(this.characters)) {
35+
throw new Error('Data is not an array');
36+
}
3437
this.logger.info('Using data.fightcore.gg based data.');
3538
this.isOnlineData = true;
3639
} catch {

0 commit comments

Comments
 (0)