-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
32 lines (26 loc) · 908 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { dirname, sep } from "std/path/mod.ts";
import { startBot } from "discordeno/mod.ts";
import { Amane } from "./bot.ts";
import { importCommands, importEvents, importPath } from "utils/loader.ts";
import { updateAppcationCommands } from "utils/updateCommands.ts";
import log from "utils/logger.ts";
import verify_config from "utils/verify-config.ts";
log.info("Starting bot...");
const configCorrect = verify_config();
if (!configCorrect) {
log.error("Please fix your env files and try again");
Deno.exit();
}
await startBot(Amane);
importPath(directory());
await importCommands();
await updateAppcationCommands();
await importEvents();
function directory(): string {
const dir = `${dirname(import.meta.url)}${sep}`;
if (Deno.build.os == "windows") {
return dir.replace(/\\/g, "/").replace("file:///", "");
} else {
return dir.replace(/\\/g, "/").replace("file://", "");
}
}