-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.ts
45 lines (34 loc) · 1.34 KB
/
index.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
43
44
45
import { config } from "./lib/config.js";
import registerCommandEvents from "./events/commands.js";
import registerWalkthroughEvents from "./events/walkthrough.js";
import registerMessageEvents from "./events/messages.js";
import { Client, Events, GatewayIntentBits, ActivityType } from "discord.js";
const client = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages],
});
const presenceList = [
{ name: "with Coder", type: ActivityType.Playing },
{ name: "with code-server", type: ActivityType.Playing },
{ name: "with envbuilder", type: ActivityType.Playing },
{ name: "with wush", type: ActivityType.Playing },
{ name: "with Terraform", type: ActivityType.Playing },
{ name: "to your issues", type: ActivityType.Listening },
{ name: "over the Coder community", type: ActivityType.Watching },
];
function shufflePresence() {
const randomPresence =
presenceList[Math.floor(Math.random() * presenceList.length)];
return client.user.setPresence({
activities: [randomPresence],
status: "online",
});
}
client.once(Events.ClientReady, () => {
console.log(`Logged in as ${client.user?.tag}!`);
registerCommandEvents(client);
registerWalkthroughEvents(client);
registerMessageEvents(client);
shufflePresence();
setInterval(shufflePresence, config.presenceDelay);
});
client.login(config.token);