Files
discordeno/testss/mod.ts
ITOH d7883855ec refactor(.github,README,gateway,plugins/fileloader,tests,types)!: make intent calculation manual
This changes the calculation of intents to be manual to the dev.
This is to improve overall consistency of our code base, also it is not a big drawback for users since intents are usually done once and then never (seldom) touched again.
2022-05-24 23:16:01 +02:00

26 lines
597 B
TypeScript

import { createBot, createRestManager, runMethod } from "../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 = createBot({
events: {},
intents: 0,
botId,
token,
});
bot.rest = createRestManager({
token,
customUrl: Deno.env.get("PROXY_REST_URL"),
secretKey: Deno.env.get("PROXY_REST_SECRET"),
});
return bot;
}