This repository has been archived by the owner on Dec 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Ayako-v1.5.js
60 lines (49 loc) · 1.96 KB
/
Ayako-v1.5.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
const readline = require('readline');
const auth = require('./Files/BaseClient/auth.json');
const client = require('./Files/BaseClient/DiscordClient');
client.pool = require('./Files/BaseClient/DataBase');
client.ch = require('./Files/BaseClient/ClientHelper');
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
rl.on('line', async (msg) =>
// eslint-disable-next-line no-eval, no-console
console.log(msg.includes('await') ? await eval(`(async () => {${msg}})()`) : eval(msg)),
);
process.setMaxListeners(2);
client.eventPaths.forEach((path) => {
const eventName = path.replace('.js', '').split(/\/+/).pop();
const eventHandler = require('./Files/Events/baseEventHandler');
if (eventName === 'ready') client.once(eventName, (...args) => eventHandler(eventName, args));
else client.on(eventName, (...args) => eventHandler(eventName, args));
});
process.on('unhandledRejection', (error) => {
client.emit('unhandledRejection', error);
});
process.on('uncaughtException', (error) => {
if (
String(error).includes("Cannot read properties of undefined (reading 'values')") ||
String(error).includes("Cannot read properties of undefined (reading 'clear')")
) {
process.exit();
}
client.ch.logger('Unhandled Exception', error);
});
process.on('promiseRejectionHandledWarning', () => {});
/*
client.rest.on('request', (request) => {
require('./Files/Events/REST Events/request')(request);
});
client.rest.on('response', (request, response) => {
require('./Files/Events/REST Events/response')(request, response);
});
client.eris.on('rawREST', (response) => {
require('./Files/Events/REST Events/response')(null, response);
});
*/
client.rest.on('rateLimited', (rateLimitInfo) => {
require('./Files/Events/REST Events/rateLimited')(rateLimitInfo);
});
// Connect to Discord
client.login(auth.token).then(() => {
// eslint-disable-next-line no-console
console.log(`| Discord Client connected at ${new Date().toUTCString()}`);
});