This repository was archived by the owner on Aug 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathsableye.js
More file actions
53 lines (44 loc) · 1.28 KB
/
sableye.js
File metadata and controls
53 lines (44 loc) · 1.28 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
50
51
52
53
'use strict';
const discordjs = require('discord.js');
const path = require('path');
global.config = require(process.env.CONFIG_FILE ?? './config.js');
global.packagejson = require('./package.json');
const BOT_EVENTS_DIR = path.resolve(__dirname, 'bot_events');
const UTILS_DIR = path.resolve(__dirname, 'utils');
global.bot = new discordjs.Client({
intents: [
discordjs.Intents.FLAGS.GUILD_MESSAGES,
discordjs.Intents.FLAGS.GUILDS,
discordjs.Intents.FLAGS.DIRECT_MESSAGES,
],
makeCache: discordjs.Options.cacheWithLimits({
MessageManager: 0,
GuildMemberManager: 0,
PresenceManager: 0,
BaseGuildEmojiManager: 0,
UserManager: 0,
}),
partials: [
'CHANNEL',
],
});
const botReady = require(path.resolve(BOT_EVENTS_DIR, 'ready.js'));
const botMessage = require(path.resolve(BOT_EVENTS_DIR, 'message.js'));
const logger = require(path.resolve(UTILS_DIR, 'Logger.js'));
global.Logger = new logger();
bot.on('ready', () => {
botReady();
});
bot.on('messageCreate', (msg) => {
botMessage(msg, null);
});
module.exports = function launch() {
global.Logger.init()
.then(() => {
bot.login(config.token);
console.log("Launching SableyeBot");
})
.catch((e) => {
console.log('Error while initiating SableyeBot', e);
});
};