slack-cleaner
slack-cleaner copied to clipboard
failed to delete
The cleaner works fine for a while but after about 50 messages I'm getting a "failed to delete" error:
[93m Failed to delete -> [0m]
followed by information on the message but not the issue. It happens with all the commands, and I've tried tried uninstalling and re-installing older versions, I can't see what the issue is. I even got a colleague to install and try it on their machine from fresh but the same error is occurring, can anyone help?
I'm having this issue as well. When it starts to fail is random, but I think on first delete attempt 50 messages is a good round number.
Here's what it looks like in my terminal:
Deleted message -> testuser : Slack cleaner test Failed to delete -> { u'text': u"Test Message", u'ts': u'1490708979.522835', u'type': u'message', u'user': u'UCVVK6N1T'} Failed to delete -> { u'text': u'Test Message ', u'ts': u'1490708969.518868', u'type': u'message', u'user': u'UCVVK6N1T'} Failed to delete -> { u'text': u'Test Message', u'ts': u'1490708616.385428', u'type': u'message', u'user': u'UCVVK6N1T'} Failed to delete -> { u'text': u"Test Message ", u'ts': u'1490708572.369337', u'type': u'message', u'user': u'UCVVK6N1T'} Deleted message -> testuser : Test Message
Some messages are still getting deleted every after every 3-4 deletes.
Is there some limits to the delete requests that slack has added?
Same issue here, failing to delete overall. Not working anymore.
I've been using slack-cleaner since November last year without issue and started getting the same problem as describe above. I added --rate 1
to all my scripts and as far as I've seen with my limited testing I'm no longer getting the failed to delete error. Rate is in seconds and only accepts an integer value so this is the smallest rate supported in 0.3.0.
The downside is I'm deleting ~3k messages which means a job that used to take ~10 mins is now taking almost an hour. But it doesn't take many resources and I'm happy to leave it ticking over in the background.
Confirming this as well. I added -- rate 1
to my script last night, checked this morning and it ran fine.
--rate 1
is working fine here as well.
This is a good fix, thanks very much! If there is a way to get it working up to speed again that would be ideal --- don't want to spend hours at the end of the day cleaning messages!
Seems slack has some sort of Rate limit now, nice to see the dev had the foresight to anticipate such a restriction 2 years ago. Anyway, rate=1 works fine, I did some tweaks to the code to see if I could get it down quicker, the fastest rate seems to be 0.7 seconds without any errors, 0.6 seemed to work at first but then started to generated odd failed to deletes. It's quite easily to modify the code yourself;
If you used pip to install just replace all variables of "args.rate_limit" with 0.7 in /usr/local/lib/pyton2.7/dist-packages/slack_cleaners/cli.py. If people really want I can make a fork allowing under 1 second to be used but this quick and dirty right now.
You can actually just change the type on the --rate
argument to float
instead of int
in the args.py
file in the same directory. Line in question is 19.
This does not appear to be a solution for me... I am the primary owner of the team yet I can't delete other members messages when in DM chats... does anyone else have this issue?
Yes, I've had this issue too: I can only delete my own DM messages
Same problem here. Rate does not work anymore. Cannot seem to delete these bot messages. What's the update?
Rate doesn't seem to do anything at all. And also getting the random failed to delete messages. Can't delete other peoples messages despite being admin or owner.
Yes, I've had this issue too: I can only delete my own DM messages
since I cannot delete the direct messages from others using the slack interface either, I guess it is intentional by slack.
@JamesK852 The math on that works out pretty well, given that a delay of 0.6 translates to exactly 100 API calls per minute, which is a nice round number for them to be limiting to. Given the fluctuation of network transit times for different requests, it makes sense that there would be random errors if making calls exactly at the limit.
Had the same issue, --rate 1
works fine.
The slack API documentation is quite clear about rate limiting, see:
Slack API rate limits
With chat.delete
you are on Tier 3
(as visited today), see:
Slack API chat delete
50+ per minute
I'm having this issue and --rate=1 does not seem to have any effect. I used to use that every time but now it seems like it's being ignored (the "Failed to delete" messages are definitely happening faster than once per second). Without --perform everything works fine and there are, according to slack-cleaner, 466 messages that will be cleaned but when I perform it, 0 are actually cleaned. Any idea why this might be? I triple checked my permissions on the Apps page but they match the required permissions as stated in the README file.
I also tried deleting files and that worked fine so I guess it is just messages?
Here's the command I am trying to run: slack-cleaner --token [TOKEN REMOVED OBVIOUSLY] --message --user "*" --channel exam --rate=1
The "exam" channel is public.
same issue as above, please please please fix. Will not delete any messages, rate does not change anything.
can you try adding --as_user
. if the problem persist, can you open another issue in https://github.com/sgratzl/slack-cleaner/ which is the maintained version