summaryrefslogtreecommitdiff
path: root/src/commands/utility/clear.js
diff options
context:
space:
mode:
author8cy <[email protected]>2020-04-16 04:56:37 -0700
committer8cy <[email protected]>2020-04-16 04:56:37 -0700
commit8c435855e647ee7aef8578e253caf91fe44c67cc (patch)
treeae0bb59de10ecec5ca2fc01dfa9190efd1f177ab /src/commands/utility/clear.js
parentno longer hosting ws, v6.0.4 (diff)
downloaddep-core-8c435855e647ee7aef8578e253caf91fe44c67cc.tar.xz
dep-core-8c435855e647ee7aef8578e253caf91fe44c67cc.zip
The Purification, v7.0.0
add: - aesthetic, oddcase, stretch, surreal - culturedtext - dogeify - howify - insult - lorem - spongebob Other Stuff: - many refactoring
Diffstat (limited to 'src/commands/utility/clear.js')
-rw-r--r--src/commands/utility/clear.js72
1 files changed, 0 insertions, 72 deletions
diff --git a/src/commands/utility/clear.js b/src/commands/utility/clear.js
deleted file mode 100644
index 6871cca..0000000
--- a/src/commands/utility/clear.js
+++ /dev/null
@@ -1,72 +0,0 @@
-const { Command } = require('discord.js-commando');
-const emoji = require('emoji-random');
-
-module.exports = class ClearUtility extends Command {
- constructor(client) {
- super(client, {
- name: 'clear',
- aliases: ['delete', 'del', 'c', 'd'],
- group: 'utility',
- memberName: 'clear',
- description: 'Clears a specified amount of messages.',
- guildOnly: true,
- args: [
- {
- key: 'deleteAmount',
- prompt: 'How many messages would you like to delete?',
- type: 'integer'
- }
- ],
- examples: [
- 'uwu!clear 23',
- 'uwu!delete 75',
- 'uwu!del 32',
- 'uwu!c 45',
- 'uwu!d 84'
- ],
- userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'MANAGE_MESSAGES'],
- clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'MANAGE_MESSAGES']
- });
- }
- async run(msg, { deleteAmount }) {
- if (msg.member.hasPermission('MANAGE_MESSAGES')) {
- if (!deleteAmount) {
- msg.reply('You haven\'t specified an amount of messages which should be deleted. ' + emoji.random()).then(deleteNotificationMessage => {
- deleteNotificationMessage.delete({ timeout: 1000 });
- });
- } else if (isNaN(deleteAmount)) {
- msg.reply('The amount parameter isn\'t a number. ' + emoji.random()).then(deleteNotificationMessage => {
- deleteNotificationMessage.delete({ timeout: 1000 });
- });
- } else if (deleteAmount > 100) {
- msg.reply('You can\'t delete more than 100 messages at once. ' + emoji.random()).then(deleteNotificationMessage => {
- deleteNotificationMessage.delete({ timeout: 1000 });
- });
- } else if (deleteAmount < 1) {
- msg.reply('You have to delete at least 1 message. ' + emoji.random()).then(deleteNotificationMessage => {
- deleteNotificationMessage.delete({ timeout: 1000 });
- });
- }
- /*else if (msg.createdTimestamp > 1209600) {
- msg.reply('due to discord rules, bots can only bulk delete messages that are under 14 days old :(')
- } */
- else {
- var clearAmount = deleteAmount + 1;
- // It took me so long to figure out why this was not really working. It would delete but an insane amount at a time.
- // I realized that because it was getting parsed as a string, it would just add 1 to it so if I tried to delete 1
- // message, it would delete 11 lol. Fixed by parsing as integer THEN adding one. 02:30 2020/04/03/2020
-
- await msg.channel.messages.fetch({
- limit: clearAmount
- }).then(messages => { // I am on v11 discord.js
- msg.channel.bulkDelete(messages);
- });
- msg.reply('It\'s been deleted ~uwu ' + emoji.random()).then(deleteNotificationMessage => {
- deleteNotificationMessage.delete({ timeout: 1000 });
- });
- }
- } else {
- msg.reply('Insufficent perms. ' + emoji.random());
- }
- }
-}; \ No newline at end of file