mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-02 08:50:07 +00:00
* feat: delete channel tests * fix: use new tests in ci * Update testss/deps.ts Co-authored-by: LTS20050703 <87189679+lts20050703@users.noreply.github.com> Co-authored-by: LTS20050703 <87189679+lts20050703@users.noreply.github.com>
27 lines
674 B
TypeScript
27 lines
674 B
TypeScript
import { createBot, createRestManager, runMethod } from "../mod.ts";
|
|
import enableCachePlugin from "../plugins/cache/mod.ts";
|
|
import { dotenv } from "./deps.ts";
|
|
|
|
dotenv({ export: true, path: `${Deno.cwd()}/.env` });
|
|
|
|
export function loadBot() {
|
|
const token = Deno.env.get("DISCORD_TOKEN");
|
|
if (!token) throw new Error("Token was not provided.");
|
|
|
|
const botId = BigInt(atob(token.split(".")[0]));
|
|
const bot = enableCachePlugin(createBot({
|
|
events: {},
|
|
intents: [],
|
|
botId,
|
|
token,
|
|
}));
|
|
|
|
bot.rest = createRestManager({
|
|
token,
|
|
customUrl: Deno.env.get("PROXY_REST_URL"),
|
|
secretKey: Deno.env.get("PROXY_REST_SECRET"),
|
|
});
|
|
|
|
return bot;
|
|
}
|