1
+ const auth = require ( './credentials.json' ) ;
2
+ const Discord = require ( 'discord.js' ) ;
3
+ const client = new Discord . Client ( ) ;
4
+
5
+ // (1) client start
6
+
7
+ client . login ( auth . token ) ;
8
+ client . on ( 'ready' , ( ) => {
9
+ console . log ( `Logged in as ${ client . user . tag } !` ) ;
10
+ } ) ;
11
+
12
+ // (2) events
13
+ client . on ( 'message' , msg => {
14
+
15
+ if ( msg . toString ( ) . startsWith ( "!core" ) ) {
16
+
17
+ var args = msg . toString ( ) . substring ( 1 ) . split ( ' ' ) ;
18
+ var cmd = args [ 1 ] ;
19
+
20
+ if ( cmd == "settickets" ) {
21
+ const embed = new Discord . RichEmbed ( )
22
+ . setColor ( '#ff8a65' )
23
+ . addField ( 'Sorry, this is not ready yet' , 'This is a development version' , false )
24
+ . setTimestamp ( )
25
+ . setFooter ( 'the all-in-one community managment solution' ) ;
26
+ msg . channel . send ( embed ) ;
27
+ } else if ( cmd == "setpunishments" ) {
28
+ const embed = new Discord . RichEmbed ( )
29
+ . setColor ( '#ff8a65' )
30
+ . addField ( 'Sorry, this is not ready yet' , 'This is a development version' , false )
31
+ . setTimestamp ( )
32
+ . setFooter ( 'the all-in-one community managment solution' ) ;
33
+ msg . channel . send ( embed ) ;
34
+ } else if ( cmd == "setpunishments" ) {
35
+ const embed = new Discord . RichEmbed ( )
36
+ . setColor ( '#ff8a65' )
37
+ . addField ( 'Sorry, this is not ready yet' , 'This is a development version' , false )
38
+ . setTimestamp ( )
39
+ . setFooter ( 'the all-in-one community managment solution' ) ;
40
+ msg . channel . send ( embed ) ;
41
+ } else if ( cmd == "setkey" ) {
42
+ if ( args . length > 1 ) {
43
+ const embed = new Discord . RichEmbed ( )
44
+ . setColor ( '#ff8a65' )
45
+ . addField ( 'Sorry, this is not ready yet' , 'This is a development version' , false )
46
+ . setTimestamp ( )
47
+ . setFooter ( 'the all-in-one community managment solution' ) ;
48
+ msg . channel . send ( embed ) ;
49
+ } else {
50
+ const embed = new Discord . RichEmbed ( )
51
+ . setColor ( '#ff8a65' )
52
+ . addField ( 'Invalid params' , 'You need a second param in order to execute this command' , false )
53
+ . setTimestamp ( )
54
+ . setFooter ( 'the all-in-one community managment solution' ) ;
55
+ msg . channel . send ( embed ) ;
56
+ }
57
+ } else {
58
+
59
+ const embed = new Discord . RichEmbed ( )
60
+ . setColor ( '#ff8a65' )
61
+ . setTitle ( 'core. help' )
62
+ . setDescription ( 'Welcome to [purecore.io](https://purecore.io/)!' )
63
+ . setAuthor ( 'quiquelhappy' , 'https://i.imgur.com/OAQblee.png' , 'https://twitter.com/quiquelhappy/' )
64
+ . addBlankField ( false )
65
+ . addField ( '!core setkey <key>' , 'Sets your discord key. This links your instance with this guild. In order to execute any other commands, you need to do this first. You can get your key [here](https://purecore.io/dashboard/)' , true )
66
+ . addBlankField ( false )
67
+ . addField ( '!core settickets' , 'Set ticket updates channel' , true )
68
+ . addField ( '!core setpunishments' , 'Set punishment updates channel' , true )
69
+ . addField ( '!core setdonations' , 'Set donation updates channel' , true )
70
+ . addBlankField ( false )
71
+ . addField ( '!core minecraft' , 'Returns your Minecraft account if any' , true )
72
+ . addField ( '!core payments' , 'Returns your payments if any' , true )
73
+ . addField ( '!core link' , 'Returns an url so you can link your discord account with your game sessions' , true )
74
+ . setTimestamp ( )
75
+ . setFooter ( 'the all-in-one community managment solution' ) ;
76
+ msg . channel . send ( embed ) ;
77
+
78
+ }
79
+
80
+ }
81
+ } ) ;
0 commit comments