-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.ts
42 lines (34 loc) · 1.07 KB
/
main.ts
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
32
33
34
35
36
37
38
39
40
41
42
import {
Client,
ErrorEvent,
GatewayIntentBits,
Partials
} from "discord.js";
import env from "./config";
import { commandResister, interactionRunner } from "./commands/runner";
import { Log } from "./utils/logger";
const client: Client = new Client({
intents: [
GatewayIntentBits.Guilds
],
partials: [Partials.Channel]
});
client.once("ready", async () =>{
process.title = `PinBot(${env.VERSION})`;
await client.application?.commands.set(commandResister(), env.DEBUG?env.DEBUG:"");
setInterval(() =>{
client.user?.setActivity({
name: `/help | ${client.guilds.cache.size}サーバーで稼働中`
});
}, 5000);
Log({ type: "info", content: `Started PinBot(${env.VERSION})` });
});
if(env.DEBUG !== undefined) client.on("debug", console.log).on("warn", console.log);
try{
client.on("interactionCreate", async (interaction: any) =>{
interactionRunner(interaction).catch(e => console.error(e));
});
}catch(e: any){
Log({ type: "error", "content": e.message })
}
client.login(env.TOKEN);