forked from epita/ruche-manager
add debug toggle
This commit is contained in:
parent
1e2888a94f
commit
4b3db2c066
1 changed files with 8 additions and 2 deletions
10
src/bot.ts
10
src/bot.ts
|
@ -30,6 +30,7 @@ const subjects = new Set([
|
|||
]);
|
||||
|
||||
async function main() {
|
||||
const is_debug = Deno.env.has("DEBUG");
|
||||
const [token_file] = Deno.args;
|
||||
const token = (await Deno.readTextFile(token_file)).trim();
|
||||
|
||||
|
@ -47,8 +48,13 @@ async function main() {
|
|||
log("Logged in as", bot.user?.username);
|
||||
|
||||
const commands = build_api_commands(subjects);
|
||||
await bot.application?.commands.set([]);
|
||||
await bot.application?.commands.set(commands, "871777993922588712");
|
||||
if (is_debug) {
|
||||
await bot.application?.commands.set([]);
|
||||
await bot.application?.commands.set(commands, "871777993922588712");
|
||||
} else {
|
||||
await bot.application?.commands.set(commands);
|
||||
await bot.application?.commands.set([], "871777993922588712");
|
||||
}
|
||||
log("Registered", commands.length, "commands.");
|
||||
|
||||
update_loop(bot, storage, update_display);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue