Allow specifying token in config file

pull/1/head
Drake 2 years ago
parent b8b3a9da30
commit 7a32f8cd07

@ -14,7 +14,8 @@
"discord": {
"channels": [
"CHANNEL_ID_HERE"
]
],
"token": "TOKEN_HERE"
},
"huggingface": {
"tokens": [

@ -4,6 +4,7 @@ import initLocalCommands from "./commands/index.ts";
import initOnMessage from "./events/onMessage.ts";
import initAIs from "./ai/index.ts";
import initDB from "./database.ts";
import config from "./config.ts";
export class GoofyAhhException extends Error {
constructor(message: string) {
@ -19,7 +20,7 @@ initCommands();
initAIs();
await BotEmitter.emit("start", {
token: Deno.env.get("TOKEN") ?? (() => {
token: Deno.env.get("TOKEN") ?? config.discord.token ?? (() => {
throw new GoofyAhhException("No token?");
})(),
intents: Intents.Guilds | Intents.GuildMessages | Intents.MessageContent,

Loading…
Cancel
Save