-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.ts
More file actions
31 lines (25 loc) · 799 Bytes
/
index.ts
File metadata and controls
31 lines (25 loc) · 799 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import * as dotenvx from "@dotenvx/dotenvx";
import { GatewayIntentBits } from "discord.js";
import { readConfig } from "./src/config.js";
import { DatadropClient } from "./src/datadrop.js";
dotenvx.config({ debug: Boolean(process.env.DEBUG), encoding: "utf-8" });
const config = await readConfig();
if (!config) throw new Error("No configuration file read; aborting startup.");
const client = new DatadropClient(
{
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.DirectMessages,
],
},
config,
);
try {
await client.start();
} catch (err) {
console.error(err);
await client?.stop();
}