mirror of
				https://github.com/keanuplayz/TravBot-v3.git
				synced 2024-08-15 02:33:12 +00:00 
			
		
		
		
	Added purge command to admin.
This commit is contained in:
		
							parent
							
								
									9d0caaf976
								
							
						
					
					
						commit
						facaf001ad
					
				
					 1 changed files with 18 additions and 0 deletions
				
			
		|  | @ -87,6 +87,24 @@ export default new Command({ | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| 			}) | 			}) | ||||||
|  | 		}), | ||||||
|  | 		purge: new Command({ | ||||||
|  | 			description: "Purges bot messages.", | ||||||
|  | 			permission: Command.PERMISSIONS.BOT_SUPPORT, | ||||||
|  | 			async run($: CommonLibrary): Promise<any> | ||||||
|  | 			{ | ||||||
|  | 				$.message.delete(); | ||||||
|  | 				const msgs = await $.channel.messages.fetch({ | ||||||
|  | 					limit: 100 | ||||||
|  | 				}); | ||||||
|  | 				const travMessages = msgs.filter(m => m.author.id === $.client.user?.id); | ||||||
|  | 
 | ||||||
|  | 				await $.message.channel.send(`Found ${travMessages.size} messages to delete.`) | ||||||
|  | 					.then(m => m.delete({ | ||||||
|  | 						timeout: 5000 | ||||||
|  | 					})); | ||||||
|  | 				await $.message.channel.bulkDelete(travMessages); | ||||||
|  | 			} | ||||||
| 		}) | 		}) | ||||||
| 	} | 	} | ||||||
| }); | }); | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue