-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.ts
More file actions
49 lines (36 loc) · 1.1 KB
/
app.ts
File metadata and controls
49 lines (36 loc) · 1.1 KB
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
46
47
48
49
import { REST, Client, GatewayIntentBits, Events } from 'discord.js';
import mainStorage from './src/mainStorage';
import { registerCommands, processCommand } from './src/commandProcessor';
import TimingWorker from './src/timingWorker';
// Inserting data into main storage
mainStorage.setData({
rest: new REST({ version: '10' }).setToken(mainStorage.token),
client: new Client({ intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.DirectMessages
] })
});
//testing area
//testing area
//testing area
//testing area
//testing area
//testing area
//testing area
// Register basic events
let client: Client = mainStorage.client!;
// onReady confirmation
client.once(Events.ClientReady, () => {
console.log(`Logged in as ${client.user?.tag}!`);
mainStorage.setDataAfterLogin();
registerCommands();
new TimingWorker(60);
});
// Registering slash commands
client.on(Events.InteractionCreate, async interaction => {
if (!interaction.isChatInputCommand()) return;
processCommand(interaction);
});
// Logging into discord bot
client.login(mainStorage.token);