@@ -9,85 +9,86 @@ const fetch = require("node-fetch");
9
9
const { request } = require ( "./helpers.js" ) ;
10
10
let db = null ;
11
11
if ( process . env . REPLIT_DB_URL ) {
12
- // use replit database if it's hosted on replit
13
- const { Database } = require ( "quick.replit" ) ;
14
- db = new Database ( process . env . REPLIT_DB_URL ) ;
12
+ // use replit database if it's hosted on replit
13
+ const { Database } = require ( "quick.replit" ) ;
14
+ db = new Database ( process . env . REPLIT_DB_URL ) ;
15
15
} else {
16
- db = require ( "quick.db" ) ;
16
+ db = require ( "quick.db" ) ;
17
17
}
18
18
19
+
19
20
const client = new GCommandsClient ( {
20
- cmdDir : join ( __dirname , "commands" ) ,
21
- eventDir : join ( __dirname , "events" ) ,
22
- language : "english" ,
23
- commands : {
24
- slash : "both" ,
25
- context : "false" ,
26
- prefix : config . prefix ,
27
- } ,
28
- intents : [
29
- Intents . FLAGS . GUILDS ,
30
- Intents . FLAGS . GUILD_MEMBERS ,
31
- Intents . FLAGS . GUILD_INTEGRATIONS ,
32
- Intents . FLAGS . GUILD_MESSAGES ,
33
- Intents . FLAGS . GUILD_MESSAGE_REACTIONS ,
34
- Intents . FLAGS . GUILD_PRESENCES ,
35
- ] ,
36
- partials : [ "CHANNEL" , "MESSAGE" , "GUILD_MEMBER" ] ,
37
- autoTyping : config . autoTyping || false ,
21
+ cmdDir : join ( __dirname , "commands" ) ,
22
+ eventDir : join ( __dirname , "events" ) ,
23
+ language : "english" ,
24
+ commands : {
25
+ slash : "both" ,
26
+ context : "false" ,
27
+ prefix : config . prefix ,
28
+ } ,
29
+ intents : [
30
+ Intents . FLAGS . GUILDS ,
31
+ Intents . FLAGS . GUILD_MEMBERS ,
32
+ Intents . FLAGS . GUILD_INTEGRATIONS ,
33
+ Intents . FLAGS . GUILD_MESSAGES ,
34
+ Intents . FLAGS . GUILD_MESSAGE_REACTIONS ,
35
+ Intents . FLAGS . GUILD_PRESENCES ,
36
+ ] ,
37
+ partials : [ "CHANNEL" , "MESSAGE" , "GUILD_MEMBER" ] ,
38
+ autoTyping : config . autoTyping || false ,
38
39
} ) ;
39
40
client . config = config ;
40
41
client . request = request ;
41
42
client . helpers = require ( "./helpers.js" ) ;
42
43
client . db = db ;
43
44
44
45
if ( ! config . token ) {
45
- console . error ( "TOKEN is missing in .env file" ) ;
46
- process . exit ( ) ;
46
+ console . error ( "TOKEN is missing in .env file" ) ;
47
+ process . exit ( ) ;
47
48
}
48
49
if ( ! config . apiKey ) {
49
- console . error ( "API_KEY is missing in .env file" ) ;
50
- process . exit ( ) ;
50
+ console . error ( "API_KEY is missing in .env file" ) ;
51
+ process . exit ( ) ;
51
52
}
52
53
53
54
client . on ( "ready" , async ( ) => {
54
- console . log ( `${ client . user . tag } (AnonDev API Bot has started) has started!` ) ;
55
- client . user . setPresence ( {
56
- activities : [
57
- { name : "Powered by api.anondev.ml" , type : "WATCHING" } ,
58
- {
59
- name : `Use ${ config . prefix } help or type / to discover slash commands` ,
60
- type : "PLAYING" ,
61
- } ,
62
- ] ,
63
- status : "online" ,
64
- } ) ;
55
+ console . log ( `${ client . user . tag } (AnonDev API Bot has started) has started!` ) ;
56
+ client . user . setPresence ( {
57
+ activities : [
58
+ { name : "Powered by api.anondev.ml" , type : "WATCHING" } ,
59
+ {
60
+ name : `Use ${ config . prefix } help or type / to discover slash commands` ,
61
+ type : "PLAYING" ,
62
+ } ,
63
+ ] ,
64
+ status : "online" ,
65
+ } ) ;
65
66
66
- if ( ! config . owner ) {
67
- // automatically fill owner in config
68
- await client . application . fetch ( ) ;
69
- config . owner = client . application . owner
70
- ? client . application . owner . id
71
- : null ;
72
- }
67
+ if ( ! config . owner ) {
68
+ // automatically fill owner in config
69
+ await client . application . fetch ( ) ;
70
+ config . owner = client . application . owner
71
+ ? client . application . owner . id
72
+ : null ;
73
+ }
73
74
} ) ;
74
75
75
76
client . on ( "log" , console . log ) ;
76
77
client . on ( "error" , console . error ) ;
77
78
78
79
if ( config . debug ) {
79
- client . on ( "debug" , console . log ) ;
80
- client . on ( "rateLimit" , console . log ) ;
81
- client . on ( "warn" , console . warn ) ;
80
+ client . on ( "debug" , console . log ) ;
81
+ client . on ( "rateLimit" , console . log ) ;
82
+ client . on ( "warn" , console . warn ) ;
82
83
}
83
84
84
85
client . login ( config . token ) ;
85
86
86
87
process . on ( "uncaughtException" , ( err ) => {
87
- console . error ( "There was an uncaught error" , err ) ;
88
- if ( config . exitOnCrash ) {
89
- process . exit ( 1 ) ;
90
- }
88
+ console . error ( "There was an uncaught error" , err ) ;
89
+ if ( config . exitOnCrash ) {
90
+ process . exit ( 1 ) ;
91
+ }
91
92
} ) ;
92
93
93
94
require ( "./auto-meme.js" ) ( client ) ;
0 commit comments