slack-cleaner icon indicating copy to clipboard operation
slack-cleaner copied to clipboard

failed to delete

Open LC26 opened this issue 7 years ago • 18 comments

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?

LC26 avatar Mar 30 '17 17:03 LC26

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?

jlietz avatar Apr 03 '17 15:04 jlietz

Same issue here, failing to delete overall. Not working anymore.

nomad5 avatar Apr 03 '17 19:04 nomad5

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.

ghost avatar Apr 04 '17 11:04 ghost

Confirming this as well. I added -- rate 1 to my script last night, checked this morning and it ran fine.

nomad5 avatar Apr 04 '17 18:04 nomad5

--rate 1 is working fine here as well.

jlietz avatar Apr 04 '17 18:04 jlietz

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!

LC26 avatar Apr 04 '17 19:04 LC26

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.

JamesK852 avatar Jun 06 '17 02:06 JamesK852

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.

mi94 avatar Jun 07 '17 19:06 mi94

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?

BakerCo avatar Jul 18 '17 18:07 BakerCo

Yes, I've had this issue too: I can only delete my own DM messages

LC26 avatar Jul 18 '17 18:07 LC26

Same problem here. Rate does not work anymore. Cannot seem to delete these bot messages. What's the update?

TheMaverickProgrammer avatar Jul 31 '17 04:07 TheMaverickProgrammer

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.

mminklet avatar Aug 08 '17 01:08 mminklet

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.

sgratzl avatar Sep 11 '17 12:09 sgratzl

@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.

kohenkatz avatar Apr 30 '18 15:04 kohenkatz

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

arnkel avatar Sep 27 '18 07:09 arnkel

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.

rmacnz avatar Apr 27 '20 17:04 rmacnz

same issue as above, please please please fix. Will not delete any messages, rate does not change anything.

elambrid avatar May 06 '20 01:05 elambrid

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

sgratzl avatar May 06 '20 16:05 sgratzl