summaryrefslogtreecommitdiff
path: root/commands/clear.js
diff options
context:
space:
mode:
author8cy <[email protected]>2020-04-10 10:16:53 -0700
committer8cy <[email protected]>2020-04-10 10:16:53 -0700
commit4b308538961facb87d73fafeab7fab5927562eff (patch)
tree8eaf88c074c379d76e7932e6fc3f32c05adb70ca /commands/clear.js
parentrework reboot, work on itemshop, v1.5.2 (diff)
downloads5nical-4b308538961facb87d73fafeab7fab5927562eff.tar.xz
s5nical-4b308538961facb87d73fafeab7fab5927562eff.zip
port to commando/ v12, 2.0.0
ported everything over to v12 and then commando in the span of 2 days no sleep lol. also now using typescript standard for cool 8)
Diffstat (limited to 'commands/clear.js')
-rw-r--r--commands/clear.js46
1 files changed, 0 insertions, 46 deletions
diff --git a/commands/clear.js b/commands/clear.js
deleted file mode 100644
index fe8e46f..0000000
--- a/commands/clear.js
+++ /dev/null
@@ -1,46 +0,0 @@
-module.exports = {
- name: 'clear',
- aliases: ['delete', 'del', 'c'],
- description: '',
- async execute(msg, args, bot) {
- if (msg.member.hasPermission('MANAGE_MESSAGES')) {
- if (!args) {
- msg.reply('you haven\'t specified an amount of messages which should be deleted.').then(deleteNotificationMessage => {
- deleteNotificationMessage.delete(1000);
- });
- } else if (isNaN(args)) {
- msg.reply('the amount parameter isn\'t a number.').then(deleteNotificationMessage => {
- deleteNotificationMessage.delete(1000);
- });
- } else if (args > 100) {
- msg.reply('you can\'t delete more than 100 messages at once.').then(deleteNotificationMessage => {
- deleteNotificationMessage.delete(1000);
- });
- } else if (args < 1) {
- msg.reply('you have to delete at least 1 message.').then(deleteNotificationMessage => {
- deleteNotificationMessage.delete(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 = parseInt(args[0]) + 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.fetchMessages({
- limit: clearAmount
- }).then(messages => { // I am on v11 discord.js
- msg.channel.bulkDelete(messages);
- });
- msg.reply('it\'s been deleted ~uwu').then(deleteNotificationMessage => {
- deleteNotificationMessage.delete(1000);
- });
- }
- } else {
- msg.reply('insufficent perms bruh');
- }
- }
-}; \ No newline at end of file