mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-02 17:00:08 +00:00
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.
26 lines
597 B
TypeScript
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;
|
|
}
|