Skip to content

Commit 7bf6cf6

Browse files
committed
fix restart command
1 parent 75f3c65 commit 7bf6cf6

2 files changed

Lines changed: 2 additions & 18 deletions

File tree

src/components/client.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ import groupJoin from "./events/groups/join";
1313
import reaction from "./events/reaction";
1414
import ready from "./events/ready";
1515

16-
import fs from "fs";
17-
import path from "path";
18-
1916
const client = new Client({
2017
authStrategy: new LocalAuth(),
2118
});

src/components/events/ready.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,7 @@ export default async function ready() {
1414
try {
1515
const tempData = JSON.parse(fs.readFileSync(hotReloadPath, "utf-8"));
1616

17-
let chatId = null;
18-
if (typeof tempData.id === "string") {
19-
chatId = tempData.id;
20-
} else if (tempData.id?._serialized) {
21-
chatId = tempData.id._serialized;
22-
} else if (tempData.id?.id) {
23-
chatId = tempData.id.id + "@c.us";
24-
}
25-
26-
if (chatId) {
27-
await client.sendMessage(chatId, "Done");
28-
return;
29-
}
30-
log.error("restart", "Could not resolve chat ID for message.");
17+
await client.sendMessage(tempData.id.remote, "Done");
3118
} catch (err) {
3219
log.error("restart", err);
3320
} finally {
@@ -40,4 +27,4 @@ export default async function ready() {
4027
});
4128
}
4229
}
43-
};
30+
}

0 commit comments

Comments
 (0)