File tree Expand file tree Collapse file tree 6 files changed +80
-56
lines changed Expand file tree Collapse file tree 6 files changed +80
-56
lines changed Original file line number Diff line number Diff line change 1+ module . exports = {
2+ name : 'interactionCreate' ,
3+
4+ /**
5+ * @param {CommandInteraction } interaction
6+ * @param {Client } client
7+ */
8+ execute ( interaction , client ) {
9+ if ( ! interaction . isCommand ( ) ) return ;
10+
11+ const command = client . slash . get ( interaction . commandName ) ;
12+ if ( ! command ) return interaction . reply ( { content : 'an Error' } ) ;
13+
14+ if ( command . ownerOnly ) {
15+ if ( interaction . user . id !== client . config . ownerID ) {
16+ return interaction . reply ( { content : "This command only for Bot Owner!" , epephemeral : true } ) ;
17+ }
18+ }
19+
20+ const args = [ ] ;
21+
22+ for ( let option of interaction . options . data ) {
23+ if ( option . type === 'SUB_COMMAND' ) {
24+ if ( option . name ) args . push ( option . name ) ;
25+ option . options ?. forEach ( x => {
26+ if ( x . value ) args . push ( x . value ) ;
27+ } ) ;
28+ } else if ( option . value ) args . push ( option . value ) ;
29+ }
30+
31+ try {
32+ command . run ( client , interaction , args )
33+ } catch ( e ) {
34+ interaction . reply ( { content : e . message } ) ;
35+ }
36+ }
37+ }
Original file line number Diff line number Diff line change 1+ module . exports = {
2+ name : 'messageCreate' ,
3+
4+ /**
5+ * @param {Message } message
6+ * @param {Client } client
7+ */
8+ execute ( message , client ) {
9+ if ( message . author . bot || ! message . guild || ! message . content . toLowerCase ( ) . startsWith ( client . config . prefix ) ) return ;
10+
11+ const [ cmd , ...args ] = message . content . slice ( client . config . botPrefix . length ) . trim ( ) . split ( " " ) ;
12+
13+ const command = client . commands . get ( cmd . toLowerCase ( ) ) || client . commands . find ( c => c . aliases ?. includes ( cmd . toLowerCase ( ) ) ) ;
14+
15+ if ( ! command ) return ;
16+
17+ if ( command . ownerOnly ) {
18+ if ( message . author . id !== client . config . ownerID ) {
19+ return message . reply ( { content : "This command only for Bot Owner!" , allowedMentions : { repliedUser : false } } ) ;
20+ }
21+ }
22+
23+ await command . run ( client , message , args ) ;
24+ }
25+ }
Original file line number Diff line number Diff line change 1+ module . exports = {
2+ name : 'ready' ,
3+ once : true ,
4+
5+ /**
6+ * @param {Client } client
7+ */
8+ execute ( client ) {
9+ // Puts an activity
10+ client . user . setActivity ( "Expectatives#1157" , {
11+ type : "WATCHING" ,
12+ name : "Expectatives#1157"
13+ } ) ;
14+
15+ // Send a message on the console
16+ console . log ( `[LOG] ${ client . user . tag } is now online!\n[LOG] Bot serving on Ready to serve in ${ client . guilds . cache . size } servers\n[LOG] Bot serving ${ client . users . cache . size } users` ) ;
17+ }
18+ }
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments