-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
63 lines (52 loc) · 1.81 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import { Bot } from 'breezer.js';
import Bio from './data/bio.json' assert { type: "json" };
import nHandler from './helpers/nHandler.js';
import mongoose from 'mongoose';
import reportHelp from './helpers/reportHelp.js';
import { reRegisterReminders } from './helpers/funcs.js';
import balHandler from './helpers/balHandler.js';
import { redi } from './helpers/redisHandler.js';
mongoose.set('strictQuery', false);
mongoose.connect(Bio.DB, (e) => console.log(e ? "Error: "+e : "[connected to DB]"));
redi.connect()
.then(() => console.log('[connected to reddis'))
.catch(e => console.log('[error on redis connection]: ', e));
const bot = new Bot({
commandsFolder: './dist/commands',
token: Bio.BOT_TOKEN,
prefix: "r ",
lang: '.js'
});
export const client = bot.bot;
const nPrefix = 'n';
client.on('messageCreate', async msg => {
if (!msg.guild) return;
if (Bio.ADMIN.TESTING) {
if (
!Bio.ADMIN.DEV_SERVERS.includes(msg.guild.id) &&
!Bio.ADMIN.DEV_CHANNELS.includes(msg.channel.id)
) {
return;
}
}
if (msg.content.toLowerCase().replace(/[ ]+/g, ' ').split(' ')[0].trim() == nPrefix) {
if (msg.author.bot) return;
await nHandler(msg);
}
if (msg.author.id == Bio.NB) {
if (msg.embeds[0]?.title?.includes('report'))
await reportHelp(msg);
if (msg.embeds[0]?.title?.includes('balance'))
await msg.react('🤑');
}
});
// @ts-ignore
client.on('messageReactionAdd', async(rxn, user) => await balHandler(rxn, user));
bot.go(async () => {
console.log(`Logged in as ${client.user?.username}`);
});
client.on('ready', async () => {
client.user?.setActivity({ name: "r help", type: "LISTENING" })
await reRegisterReminders();
console.log('Reminders Re-registered!');
})