Add leave command, update util to show guildid
This commit is contained in:
		
							parent
							
								
									202a5adcd7
								
							
						
					
					
						commit
						fa8a038e5b
					
				
							
								
								
									
										25
									
								
								dot-commands/leave.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								dot-commands/leave.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,25 @@ | |||||||
|  | const fn = require('../modules/functions.js'); | ||||||
|  | 
 | ||||||
|  | module.exports = { | ||||||
|  | 	name: "leave", | ||||||
|  | 	description: "Leave a server", | ||||||
|  | 	usage: "<serverID> [<serverID>]".leave, | ||||||
|  | 	permission: "owner", | ||||||
|  | 	async execute(message, commandData) { | ||||||
|  | 		if (fn.dotCommands.checkPermissions(this.permission, message.author.id)) { | ||||||
|  | 			try { | ||||||
|  | 				// Code Here
 | ||||||
|  | 				const serverIds = commandData.args.split(" "); | ||||||
|  |                 for (let i = 0; i < serverIds.length; i++) { | ||||||
|  |                     const id = serverIds[i]; | ||||||
|  |                     const guild = await message.client.guilds.fetch(id); | ||||||
|  |                     await guild.leave(); | ||||||
|  |                     await message.channel.send("Left Guild: " + id); | ||||||
|  |                 } | ||||||
|  | 			} catch (err) { | ||||||
|  | 				console.error(err); | ||||||
|  | 				await message.reply(fn.builders.errorEmbed("There was an error running the command: " + err)); | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | } | ||||||
| @ -27,7 +27,7 @@ client.once('ready', async () => { | |||||||
|     // watchRequestRates();
 |     // watchRequestRates();
 | ||||||
|     const guilds = client.guilds.cache; |     const guilds = client.guilds.cache; | ||||||
|     guilds.each(g => { |     guilds.each(g => { | ||||||
|         console.log(g.name + "," + g.ownerId); |         console.log(g.name + "," + g.id + "," + g.ownerId); | ||||||
|     }); |     }); | ||||||
|     process.exit(); |     process.exit(); | ||||||
| }); | }); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user