Skip to content

Commit 5f0e634

Browse files
committed
Only register commands when the bot is ready.
1 parent 8da5654 commit 5f0e634

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

lib/discord/client.dart

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,23 @@ class Codercord {
6262

6363
await client.connect();
6464

65-
try {
66-
await loadValues(client);
67-
} catch (error, trace) {
68-
logger.log(
69-
Level.SEVERE,
70-
"Could not load configuration values.",
71-
error,
72-
trace,
73-
);
74-
exit(1);
75-
}
76-
await registerInteractionHandlers();
77-
7865
client.eventsWs.onReady.listen((event) async {
66+
logger.info("Loading config values..");
67+
try {
68+
await loadValues(client);
69+
} catch (error, trace) {
70+
logger.log(
71+
Level.SEVERE,
72+
"Could not load configuration values.",
73+
error,
74+
trace,
75+
);
76+
exit(1);
77+
}
78+
79+
logger.info("Registering commands..");
80+
await registerInteractionHandlers();
81+
7982
logger.info("Codercord is ready !");
8083

8184
logger.info(
@@ -95,7 +98,8 @@ class Codercord {
9598
//print(e.toString().contains("40058"));
9699

97100
logger.info(
98-
"Couldn't send message because thread owner did not post message, retrying in ${retryIn.toString()}.");
101+
"Couldn't send message because thread owner did not post message, retrying in ${retryIn.toString()}.",
102+
);
99103
await Future.delayed(retryIn);
100104
await event.thread.sendMessage(categoryMultiSelectMessage);
101105
}

0 commit comments

Comments
 (0)