Comments (13)
does it return the cannot delete message
error message or are just no messages are about to be deleted. In the latter case, could be a duplicate to #38
from slack-cleaner.
Having the same issues. I have a channel with lot's of messages from an app bot I have. When I di
slack-cleaner --token ${TOKEN} --message --channel ${CHANNEL} --bot --perform --rate 2
I get Failed to delete (cant_delete_message)->
. Any idea how to solve this and way I get this?
I can delete users messages ok, but issues are with bot ones.
Thx.
from slack-cleaner.
Hi can you try the develop branch of this project. it follows a different approach, a pure python one. but allows you more control about which messages should be deleted.
https://github.com/sgratzl/slack-cleaner/tree/develop and https://slack-cleaner2.readthedocs.io/en/latest/modules.html
thus it would be easier to come up with a more specific reason why the message cannot be deleted
from slack-cleaner.
I did and I get
Traceback (most recent call last):
File "/Users/mac/.virtualenvs/crawless/bin/slack-cleaner", line 10, in <module>
sys.exit(main())
File "/Users/mac/.virtualenvs/crawless/lib/python3.7/site-packages/slack_cleaner2/cli.py", line 216, in main
_delete_messages(slack, args)
File "/Users/mac/.virtualenvs/crawless/lib/python3.7/site-packages/slack_cleaner2/cli.py", line 73, in _delete_messages
user = _resolve_user(slack, args)
File "/Users/mac/.virtualenvs/crawless/lib/python3.7/site-packages/slack_cleaner2/cli.py", line 42, in _resolve_user
return next(filter(match_user(args.user), slack.users))
File "/Users/mac/.virtualenvs/crawless/lib/python3.7/site-packages/slack_cleaner2/predicates.py", line 166, in match_user
regex = re.compile('^' + pattern + '$', re.I)
TypeError: can only concatenate str (not "NoneType") to str
When running:
slack-cleaner --token ${TOKEN} --message --channel ${CHANNEL} --bot --perform --rate 2
from slack-cleaner.
Hi @sgratzl, any update on this issue?
from slack-cleaner.
the easiest way would be to write a custom python script and use the library directly.
e.g. untested python code but should be quite right
from slack_cleaner2 import *
s = SlackCleaner(TOKEN, sleep_for=2)
channel = next((c for c in s.channels if c.name == CHANNEL), None)
if channel:
for msg in channel.msgs():
if msg.bot:
msg.delete()
from slack-cleaner.
re cli: you can try to add --user "*"
from slack-cleaner.
@sgratzl still getting the same issues with cant_delete_message
with the code you're mentioning.
How can we know that is the issues? I'm using a legacy token.
from slack-cleaner.
when looking at https://api.slack.com/methods/chat.delete there are the following restrictions:
When used with a typical user token, may only delete messages posted by that user.
When used with an admin user's user token, may delete most messages posted in a workspace.
When used with a bot user's token, may delete only messages posted by that bot user.
so are you an admin? Moreover, you can try to set the as_user
flag as in
msg.delete(as_user=True)
from slack-cleaner.
Hi.
Sorry, I was not admin, with admin token I can delete now.
Thx!
from slack-cleaner.
happy that you found the issue
from slack-cleaner.
the easiest way would be to write a custom python script and use the library directly.
e.g. untested python code but should be quite right
from slack_cleaner2 import * s = SlackCleaner(TOKEN, sleep_for=2) channel = next(c for c in s.channels if c.name == CHANNEL, None) if channel: for msg in channel.msgs(): if msg.bot: msg.delete()
little syntax change, channel = next((c for c in s.channels if c.name == 'random'), None)
missing paranthesis
from slack-cleaner.
thx
from slack-cleaner.
Related Issues (20)
- missing_argument error when trying to use provided example HOT 4
- slacker.Error: invalid_auth HOT 2
- how 'catch' "unknown error occurred" ? HOT 2
- Mac M1 Support HOT 3
- Enterprise Grid
- How to delete channels? HOT 1
- slacker.Error: thread_not_found HOT 1
- conversations.list limit 100 default issue HOT 2
- Does this script support Free and Enterprise Slack Orgs? HOT 1
- Can't delete messages HOT 8
- Can't see privat channels HOT 3
- Docker image returning error HOT 1
- Delete Slack channel HOT 1
- What OAuth scope/method is needed to be able to bulk delete messages HOT 1
- slacker.Error: invalid_auth HOT 1
- AttributeError: 'Slacker' object has no attribute 'conversations' HOT 1
- slacker.Error: invalid_auth HOT 8
- slacker.Error: method_deprecated HOT 4
- Does not delete Tombstoned files HOT 2
- Provide a slack app manifest.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from slack-cleaner.