Skip to content

Commit

Permalink
Fall back to @yukikaze-bot/erlpack if erlpack cant be found or loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
TheArcaneBrony committed Oct 9, 2024
1 parent 28715f7 commit 3585e93
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 9 deletions.
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion src/gateway/events/Connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ let erlpack: ErlpackType | null = null;
try {
erlpack = require("erlpack") as ErlpackType;
} catch (e) {
// empty
console.log("Failed to import erlpack: ", e);
try {
erlpack = require("@yukikaze-bot/erlpack") as ErlpackType;
} catch (e) {
console.log("Failed to import @yukikaze-bot/erlpack: ", e);
}
}

// TODO: check rate limit
Expand Down
7 changes: 6 additions & 1 deletion src/gateway/events/Message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ let erlpack: ErlpackType | null = null;
try {
erlpack = require("erlpack") as ErlpackType;
} catch (e) {
// empty
console.log("Failed to import erlpack: ", e);
try {
erlpack = require("@yukikaze-bot/erlpack") as ErlpackType;
} catch (e) {
console.log("Failed to import @yukikaze-bot/erlpack: ", e);
}
}

export async function Message(this: WebSocket, buffer: WS.Data) {
Expand Down
7 changes: 6 additions & 1 deletion src/gateway/util/Send.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ let erlpack: ErlpackType | null = null;
try {
erlpack = require("erlpack") as ErlpackType;
} catch (e) {
// empty
console.log("Failed to import erlpack: ", e);
try {
erlpack = require("@yukikaze-bot/erlpack") as ErlpackType;
} catch (e) {
console.log("Failed to import @yukikaze-bot/erlpack: ", e);
}
}

// don't care
Expand Down

0 comments on commit 3585e93

Please sign in to comment.