mirror of
				https://github.com/Mestima/luna.git
				synced 2025-10-29 23:52:35 +00:00 
			
		
		
		
	added clear admin command
This commit is contained in:
		
							
								
								
									
										26
									
								
								src/commands/clear/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								src/commands/clear/index.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,26 @@ | |||||||
|  | import { SlashCommandBuilder, EmbedBuilder, PermissionsBitField } from 'discord.js'; | ||||||
|  |  | ||||||
|  | export default { | ||||||
|  |   data: new SlashCommandBuilder() | ||||||
|  |     .setName('clear') | ||||||
|  |     .setDescription('Deletes chosen amount of messages') | ||||||
|  |     .addIntegerOption((option) => { | ||||||
|  |       option.setName('amount') | ||||||
|  |         .setDescription('amount of messages to delete') | ||||||
|  |         .setMinValue(1) | ||||||
|  |         .setMaxValue(25) | ||||||
|  |         .setRequired(true); | ||||||
|  |       return option; | ||||||
|  |     }) | ||||||
|  |     .setDMPermission(false) | ||||||
|  |     .setDefaultMemberPermissions(PermissionsBitField.Flags['Administrator']), | ||||||
|  |   async execute(interaction, api) { | ||||||
|  |     const amount = interaction.options.getInteger('amount'); | ||||||
|  |     await interaction.channel.bulkDelete(amount); | ||||||
|  |  | ||||||
|  |     const embed = new EmbedBuilder() | ||||||
|  |       .setTitle(`Deleted ${amount} messages in total`) | ||||||
|  |       .setColor(interaction.member.displayColor); | ||||||
|  |     await interaction.reply({ embeds: [ embed ] }); | ||||||
|  |   } | ||||||
|  | }; | ||||||
		Reference in New Issue
	
	Block a user