Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General Maintenance #420

Merged
merged 5 commits into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"rules": {
"no-unused-vars": "warn",
"no-console": "off",
"@typescript-eslint/no-require-imports": "off",
"no-undef": "warn",
"no-constant-condition": "warn",
"indent": ["error", "tab"],
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ jobs:

- name: build
run: npm run build --if-present

- name: Prisma
run: npx prisma generate
1,178 changes: 807 additions & 371 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@
"devDependencies": {
"@types/better-sqlite3": "^7.6.5",
"@types/fs-extra": "^11.0.3",
"@types/node": "^20.8.6",
"@types/node": "^22.7.5",
"@types/pg": "^8.10.7",
"@types/websocket": "^1.0.8",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"@typescript-eslint/eslint-plugin": "^8.8.1",
"@typescript-eslint/parser": "^8.8.1",
"eslint": "^8.51.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^9.0.0",
Expand Down
5 changes: 3 additions & 2 deletions src/events/ready.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import readline from "readline";
import axios from "axios";
import {client as WebSocketClient, connection} from "websocket";
import {ActionRowBuilder, ButtonBuilder, ButtonStyle, ColorResolvable, EmbedBuilder, Message} from "discord.js";
import {ActionRowBuilder, ButtonBuilder, ButtonStyle, ChannelType, ColorResolvable, EmbedBuilder, Message} from "discord.js";
import os from "os";
import {BaseEvent, ExtendedClient, SponsorType} from "../structure";

Expand Down Expand Up @@ -87,7 +87,8 @@ export default class ReadyEvent extends BaseEvent {
});
} else {
const channel = this.client.channels.cache.get(this.client.config.openTicketChannelId);
if(!channel || !channel.isTextBased()) return console.error("Invalid openTicketChannelId");
if(channel?.type !== ChannelType.GuildText)
return console.error("Invalid openTicketChannelId");
channel.send({
embeds: [embed],
components: [row]
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {ConfigType, ExtendedClient} from "./structure";

// Initalize .env file as environment
try {envconf();}
catch(ex) {console.log(".env failed to load");}
catch {console.log(".env failed to load");}

// Although invalid type, it should be good enough for now until more stuff needs to be handled here
process.on("unhandledRejection", (reason: string, promise: string, a: string) => {
Expand Down
4 changes: 4 additions & 0 deletions src/utils/close.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ export async function close(
components: [rowAction]
})
.catch((e) => console.log(e));

// Workaround for type handling, rewrite should not follow this.
if(interaction.channel && interaction.channel.type !== ChannelType.GuildText)
throw Error("Close util used in a non-text channel");

interaction.channel
?.send({
Expand Down
2 changes: 1 addition & 1 deletion src/utils/translation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export class Translation {
getNoErrorSubValue(...keys: string[]): string | undefined {
try {
return this.getSubValue(...keys);
} catch(ex) {
} catch {
return;
}
}
Expand Down