File tree Expand file tree Collapse file tree 5 files changed +21
-14
lines changed
Expand file tree Collapse file tree 5 files changed +21
-14
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ module.exports = {
99 * @param {String[] } args
1010 */
1111 run : async ( client , message , args ) => {
12- message . send ( 'Loading data...' ) . then ( async ( msg ) => {
12+ message . send ( 'Loading data...' ) . then ( async ( msg ) => {
1313 msg . delete ( ) ;
1414 return message . send ( `🏓Latency is ${ msg . _createdAt - message . _createdAt } ms.` ) ;
1515 } ) ;
Original file line number Diff line number Diff line change 11const client = require ( '../index' ) ;
22
33client . on ( 'messageCreated' , async ( message ) => {
4+
45 if ( message . author && message . author . raw . type == 'bot' ) return ;
5- if ( ! message . content . toLowerCase ( ) . startsWith ( process . env . PREFIX ) ) return ;
6- const [ cmd , ...args ] = message . content . substring ( process . env . PREFIX . length ) . split ( / + / g) ;
6+
7+ if ( ! message . content . toLowerCase ( ) . startsWith ( process . env [ "PREFIX" ] ) ) return ;
8+
9+ const [ cmd , ...args ] = message . content . substring ( process . env [ "PREFIX" ] . length ) . split ( / + / g) ;
710
811 const command = client . commands . get ( cmd . toLowerCase ( ) ) || client . commands . find ( c => c . aliases ?. includes ( cmd . toLowerCase ( ) ) ) ;
9-
12+
1013 if ( ! command ) return ;
14+
15+ message . channel ??= await client . channels . fetch ( message . channelId ) ;
1116 await command . run ( client , message , args ) ;
1217} )
Original file line number Diff line number Diff line change @@ -10,9 +10,9 @@ const globPromise = promisify(glob);
1010module . exports = async ( client ) => {
1111
1212 // Commands
13- const commandFiles = await globPromise ( `commands/*.js` ) ;
13+ const commandFiles = await globPromise ( `${ process . cwd ( ) } / commands/** /*.js` ) ;
1414 commandFiles . map ( ( value ) => {
15- const file = require ( '../' + value ) ;
15+ const file = require ( value ) ;
1616 const splitted = value . split ( "/" ) ;
1717 const directory = splitted [ splitted . length - 2 ] ;
1818
@@ -23,7 +23,7 @@ module.exports = async (client) => {
2323 } ) ;
2424
2525 // Events
26- const eventFiles = await globPromise ( `events/*.js` ) ;
27- eventFiles . map ( ( value ) => require ( '../' + value ) ) ;
26+ const eventFiles = await globPromise ( `${ process . cwd ( ) } / events/*.js` ) ;
27+ eventFiles . map ( ( value ) => require ( value ) ) ;
2828
2929}
Original file line number Diff line number Diff line change 1- const { Client } = require ( 'guilded.js' ) ;
21require ( 'dotenv' ) . config ( ) ;
2+ const { Client } = require ( 'guilded.js' ) ;
3+ const { Collection } = require ( '@discordjs/collection' ) ;
34
45const client = new Client ( {
5- token : process . env . TOKEN
6+ token : process . env [ " TOKEN" ]
67} ) ;
78
89module . exports = client ;
910
1011// Global Variables
11- client . commands = new Map ( ) ;
12+ client . commands = new Collection ( ) ;
1213
1314require ( './handler' ) ( client ) ;
1415
Original file line number Diff line number Diff line change 11{
22 "name" : " gjs-base-handler" ,
3- "version" : " 1.0 .0" ,
3+ "version" : " 1.1 .0" ,
44 "description" : " A guilded.js base handler for bots!" ,
55 "main" : " index.js" ,
66 "scripts" : {
1616 "author" : " MixDevCode" ,
1717 "license" : " ISC" ,
1818 "dependencies" : {
19+ "@discordjs/collection" : " ^1.4.0" ,
1920 "dotenv" : " ^16.0.3" ,
20- "glob" : " ^8 .1.0 " ,
21- "guilded.js" : " ^0.17.1 "
21+ "glob" : " ^7 .1.7 " ,
22+ "guilded.js" : " ^0.20.0 "
2223 }
2324}
You can’t perform that action at this time.
0 commit comments