31 lines
908 B
TypeScript
31 lines
908 B
TypeScript
import { AllIntents, Client, ComponentTypes, MessageFlags } from "oceanic.js";
|
|
import { selfappReq } from "./selfappReq";
|
|
import { setupJoinRequestHandler } from "./joinRequestHandler";
|
|
import { Constants } from "./Constants";
|
|
import { Divider, generateList, generateUserComponent, Header } from "./cv2";
|
|
import { openDb } from "./database";
|
|
|
|
export const client = new Client({
|
|
auth: `Bot ${process.env.BOT_TOKEN}`,
|
|
gateway: {
|
|
intents: AllIntents,
|
|
compress: false
|
|
}
|
|
});
|
|
|
|
client.on("ready", async () => {
|
|
console.log(`Logged in as ${client.user.tag}`);
|
|
console.log("Checking user token");
|
|
const selfappInfo = await selfappReq("/users/@me", "GET");
|
|
if (!selfappInfo.username) console.error("Can't use selfapp");
|
|
else console.log("Can use selfapp");
|
|
|
|
setupJoinRequestHandler(client.shards.first()!);
|
|
});
|
|
|
|
process.on("uncaughtException", (e) => {
|
|
console.error(e);
|
|
});
|
|
|
|
openDb();
|
|
client.connect();
|