-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
bot.js
63 lines (51 loc) · 1.51 KB
/
bot.js
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
const DiscordJS = require('discord.js');
const { IntentsBitField, Partials } = require('discord.js');
const WOKCommands = require('wokcommands');
const path = require('path');
const dotenv = require('dotenv');
const mongoose = require('mongoose');
const Collection = require('./src/models/guildSettings');
const express = require('express');
app = express();
dotenv.config();
mongoose.connect(process.env.MONGO_URI);
const client = new DiscordJS.Client({
intents: [
IntentsBitField.Flags.Guilds,
IntentsBitField.Flags.GuildMessages,
IntentsBitField.Flags.GuildMessageReactions,
IntentsBitField.Flags.DirectMessages,
IntentsBitField.Flags.MessageContent,
],
partials: [Partials.Channel],
});
client.on('ready', async (bot) => {
console.log(`Logged in as ${bot.user.tag}`);
new WOKCommands({
client,
commandsDir: path.join(__dirname, './src/commands'),
events: {
dir: path.join(__dirname, './src/events'),
},
testServers: ['906969919260876810'],
mongoUri: process.env.MONGO_URI,
});
bot.user.setActivity('The new True Bot', { type: 'WATCHING' });
});
client.on('guildCreate', async (guild) => {
await new Collection({
_id: guild.id,
serverOwner: guild.ownerId,
staffRole: '',
verifyChannel: '',
logsChannel: '',
verifiedRole: '',
muteRole: '',
loggingChannel: '',
}).save();
});
client.on('guildDelete', async (guild) => {
Collection.findOneAndRemove({ _id: guild.id });
});
client.login(process.env.TOKEN);
app.listen(8999, () => {});