Skip to content

Commit

Permalink
Fix type in protocolstatus
Browse files Browse the repository at this point in the history
  • Loading branch information
nekiro committed Nov 24, 2024
1 parent 8311666 commit 87929ab
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/cache/protocolStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ export const updateCache = async () => {

try {
const socket = new PromiseSocket(new net.Socket());
await socket.connect(
parseInt(process.env.STATUS_PORT as string),
process.env.STATUS_HOST as string
);
await socket.connect(parseInt(process.env.STATUS_PORT as string), process.env.STATUS_HOST as string);

await socket.write(
// ASCII characters
Expand All @@ -45,7 +42,7 @@ export const updateCache = async () => {
// 0xFF -> protocol identifier (protocol status)
// 0xFF -> status byte
// 0x69 0x6E 0x66 0x6F (info) -> string
Buffer.from([0x06, 0x00, 0xff, 0xff, 0x69, 0x6e, 0x66, 0x6f])
Buffer.from([0x06, 0x00, 0xff, 0xff, 0x69, 0x6e, 0x66, 0x6f]),
);

// wait 1s for response
Expand All @@ -59,7 +56,7 @@ export const updateCache = async () => {
cache.uptime = doc.tsqp.serverinfo.uptime;
cache.online = true;
cache.name = doc.tsqp.serverinfo.servername;
} catch ({ code }) {
} catch ({ code }: any) {
if (code === "ECONNREFUSED") {
cache.online = false;
}
Expand Down

0 comments on commit 87929ab

Please sign in to comment.