File tree 1 file changed +19
-0
lines changed
1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -250,6 +250,25 @@ module.exports = {
250
250
251
251
return returnObject ;
252
252
} ,
253
+ /**
254
+ * @param {String } name
255
+ * @param {Discord.Client } client
256
+ * @param {Boolean } notify
257
+ * @returns {Discord.Guild | void }
258
+ */
259
+ findGuild : ( name , client , notify = true ) => {
260
+ if ( ! name ) return module . exports . logError ( `[Utils] [findGuild] Invalid input for guild name.` ) ;
261
+ if ( ! client ) return module . exports . logError ( `[Utils] [findGuild] Invalid input for client.` ) ;
262
+ if ( typeof name == "bigint" || typeof name == "number" ) name = name . toString ( ) ;
263
+
264
+ let returnObject = false ;
265
+ const guild = client . guilds . cache . find ( ( g ) => g . name . toLowerCase ( ) === name . toLowerCase ( ) || g . id === name ) ;
266
+
267
+ if ( guild ) returnObject = guild ;
268
+ else if ( notify ) module . exports . logError ( `[Utils] [findGuild] ${ chalk . bold ( name ) } guild was not found.` ) ;
269
+
270
+ return returnObject ;
271
+ } ,
253
272
/**
254
273
* @param {Discord.GuildMember } member
255
274
* @param {String | Array } name
You can’t perform that action at this time.
0 commit comments