Skip to content

Commit 8e89fc3

Browse files
committed
Update packages, use pnpm, & refactor bot toys
commit 45b99cd Author: Butterscotch! <bscotchvanilla@gmail.com> Date: Wed Apr 15 06:59:25 2026 -0400 Fix result skeleton commit b20f946 Author: Butterscotch! <bscotchvanilla@gmail.com> Date: Wed Apr 15 06:55:20 2026 -0400 Fix text colour commit 8a3f46f Author: Butterscotch! <bscotchvanilla@gmail.com> Date: Wed Apr 15 06:50:30 2026 -0400 Clean up bot toy functionality commit 4fbc2f5 Author: Butterscotch! <bscotchvanilla@gmail.com> Date: Wed Apr 15 06:13:11 2026 -0400 Reformat and lint frontend & bot commit e7ee1bd Author: Butterscotch! <bscotchvanilla@gmail.com> Date: Wed Apr 15 05:15:54 2026 -0400 Fix ESLint config commit ba83d5d Author: Butterscotch! <bscotchvanilla@gmail.com> Date: Wed Apr 15 04:01:06 2026 -0400 Migrate ESLint stuff commit 61e1167 Author: Butterscotch! <bscotchvanilla@gmail.com> Date: Wed Apr 15 03:49:37 2026 -0400 Switch to pnpm & update all npm packages
1 parent 660c065 commit 8e89fc3

24 files changed

Lines changed: 5357 additions & 306 deletions

.eslintrc.json

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/workflows/frontend.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ jobs:
4747
shell: bash
4848
run: |
4949
cd bingus-frontend
50-
npm i
51-
npm run build
50+
pnpm i
51+
pnpm run build
5252
5353
- name: Upload artifact
5454
uses: actions/upload-pages-artifact@v4

.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
24.14.1

bingus-bot/.eslintrc.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

bingus-bot/eslint.config.mts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import globals from "globals";
2+
import base from "../eslint.config.mts";
3+
import { defineConfig } from "eslint/config";
4+
5+
export default defineConfig([
6+
base,
7+
{
8+
languageOptions: {
9+
globals: {
10+
...globals.node,
11+
},
12+
ecmaVersion: "latest",
13+
sourceType: "module",
14+
},
15+
},
16+
]);

bingus-bot/package.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,18 @@
1010
"scripts": {
1111
"test": "echo \"Error: no test specified\" && exit 1",
1212
"build": "tsc",
13-
"start": "npm run build && node dist/index.js"
13+
"start": "pnpm run build && node dist/index.js",
14+
"lint": "eslint --max-warnings=0 \"src/**/*.{js,jsx,ts,tsx,json}\" && prettier --check \"src/**/*.{js,jsx,ts,tsx,css,scss,md,json}\"",
15+
"lint:fix": "eslint --fix --max-warnings=0 \"src/**/*.{js,jsx,ts,tsx,json}\" && pnpm run format",
16+
"format": "prettier --write \"src/**/*.{js,jsx,ts,tsx,css,scss,md,json}\""
1417
},
1518
"dependencies": {
16-
"discord.js": "^14.14.1",
17-
"wink-eng-lite-web-model": "^1.5.2",
18-
"wink-nlp": "^2.1.0"
19+
"discord.js": "^14.26.3",
20+
"wink-eng-lite-web-model": "^1.8.1",
21+
"wink-nlp": "^2.4.0"
1922
},
2023
"devDependencies": {
21-
"@tsconfig/node18": "^18.2.3",
22-
"@types/node": "^20.11.30"
24+
"@tsconfig/node24": "^24.0.4",
25+
"@types/node": "^25.6.0"
2326
}
2427
}

bingus-bot/src/commands/ask.ts

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,25 @@ import {
77
import { Command } from "../index.js";
88
import { EmbedList, fetchBingus, fetchBingusData } from "../util.js";
99

10-
const textCleanRegex = /[^a-z ]/gi
10+
const textCleanRegex = /[^a-z ]/gi;
1111

1212
async function getFaqConfig() {
13-
return (await fetchBingusData()).faqs.flatMap((x) =>
14-
x.keywords.filter((x) => x.length > 0 && x.length <= 100),
15-
).map((x) => ({
16-
clean: x.toLowerCase().replaceAll(textCleanRegex, ""),
17-
orig: x
18-
}));
13+
return (await fetchBingusData()).faqs
14+
.flatMap((x) => x.keywords.filter((x) => x.length > 0 && x.length <= 100))
15+
.map((x) => ({
16+
clean: x.toLowerCase().replaceAll(textCleanRegex, ""),
17+
orig: x,
18+
}));
1919
}
2020

2121
let faqConfig = await getFaqConfig();
2222

23-
setInterval(async () => {
24-
faqConfig = await getFaqConfig();
25-
}, 60 * 60 * 1000); // Do it every hour
23+
setInterval(
24+
async () => {
25+
faqConfig = await getFaqConfig();
26+
},
27+
60 * 60 * 1000,
28+
); // Do it every hour
2629

2730
export const askCommand: Command = {
2831
builder: new SlashCommandBuilder()
@@ -56,7 +59,6 @@ export const askCommand: Command = {
5659
),
5760
),
5861
async run(interaction) {
59-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
6062
const query = interaction.options.getString("query")!;
6163
const customOption = interaction.options.getString("custom");
6264
const first = customOption === "FIRST";
@@ -101,16 +103,24 @@ export const askCommand: Command = {
101103
),
102104
);
103105

104-
await embedList.sendChatInput(interaction, customOption === "KINDA_VISIBLE");
106+
await embedList.sendChatInput(
107+
interaction,
108+
customOption === "KINDA_VISIBLE",
109+
);
105110
} catch (error) {
106111
console.error(error);
107112
interaction.editReply("An error occurred while fetching results.");
108113
}
109114
},
110115
async autocomplete(interaction) {
111-
const focusedValue = interaction.options.getFocused().toLowerCase().replaceAll(textCleanRegex, "");
116+
const focusedValue = interaction.options
117+
.getFocused()
118+
.toLowerCase()
119+
.replaceAll(textCleanRegex, "");
112120
const filtered = faqConfig.filter((x) => x.clean.includes(focusedValue));
113121
filtered.length = Math.min(filtered.length, 25);
114-
await interaction.respond(filtered.map((x) => ({ name: x.orig, value: x.orig })));
122+
await interaction.respond(
123+
filtered.map((x) => ({ name: x.orig, value: x.orig })),
124+
);
115125
},
116126
};

bingus-bot/src/contexts/reply.ts

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export const replyContext: ContextMenu = {
1515
.setType(ApplicationCommandType.Message),
1616

1717
async run(interaction) {
18-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1918
const query = interaction.targetMessage.content;
2019
console.log(
2120
`User ${interaction.user} asked about "${query}" for ${interaction.targetMessage.author}`,
@@ -31,30 +30,26 @@ export const replyContext: ContextMenu = {
3130
}
3231

3332
const show = new ButtonBuilder()
34-
.setCustomId('show')
33+
.setCustomId("show")
3534
.setLabel("Show message")
3635
.setStyle(ButtonStyle.Primary);
3736

3837
const message = await interaction.editReply({
39-
embeds: [
40-
replyEmbed(interaction, data)
41-
],
38+
embeds: [replyEmbed(interaction, data)],
4239
components: [new ActionRowBuilder<ButtonBuilder>().addComponents(show)],
4340
});
4441

4542
await message.awaitMessageComponent({
46-
time: EmbedList.MAX_TIME
47-
})
43+
time: EmbedList.MAX_TIME,
44+
});
4845

4946
interaction.editReply({
5047
content: "Replied to message!",
5148
embeds: [],
52-
components: []
49+
components: [],
5350
});
5451
interaction.targetMessage.reply({
55-
embeds: [
56-
replyEmbed(interaction, data)
57-
],
52+
embeds: [replyEmbed(interaction, data)],
5853
});
5954
} catch (error) {
6055
console.error(error);

bingus-bot/src/contexts/replyWithList.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export const replyListContext: ContextMenu = {
1414
.setType(ApplicationCommandType.Message),
1515

1616
async run(interaction) {
17-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1817
const query = interaction.targetMessage.content;
1918
console.log(
2019
`User ${interaction.user} asked about "${query}" for ${interaction.targetMessage.author}`,
@@ -35,24 +34,20 @@ export const replyListContext: ContextMenu = {
3534
}
3635

3736
const show = new ButtonBuilder()
38-
.setCustomId('show')
37+
.setCustomId("show")
3938
.setLabel("Show message")
40-
.setStyle(ButtonStyle.Primary)
39+
.setStyle(ButtonStyle.Primary);
4140

4241
const embedListEph = new EmbedList(show);
4342
embedListEph.push(
44-
...data.slice(0, 5).map(
45-
(res) =>
46-
replyEmbed(interaction, res)
47-
),
43+
...data.slice(0, 5).map((res) => replyEmbed(interaction, res)),
4844
);
4945

50-
const selectedIndex = await embedListEph.sendChatInput(interaction)
46+
const selectedIndex = await embedListEph.sendChatInput(interaction);
5147

5248
interaction.targetMessage.reply({
5349
embeds: [replyEmbed(interaction, data[selectedIndex])],
5450
});
55-
5651
} catch (error) {
5752
console.error(error);
5853
interaction.editReply("An error occurred while fetching results.");

0 commit comments

Comments
 (0)