kfei / slack-cleaner

:speech_balloon: Bulk delete messages and files on Slack
MIT License
1.24k stars 144 forks source link

Channel, direct message or private group not found #71

Open alanmetzz opened 5 years ago

alanmetzz commented 5 years ago

When trying to erase all messages from a private channel, but get this result:

Channel, direct message or private group not found

I used: slack-cleaner --token TOKEN --message --group name_of_channel --before 20181101

I also used it: slack-cleaner --token TOKEN --message --channel name_of_channel --before 20181101

I don't think it works with a Private Channel. Can anyone tell me?

Thank's.

alanmetzz commented 5 years ago

I find a solution.

Follows bellow :

Line 288 of /usr/lib/python[version]/slacker/init.py ~~ Edit the argument channels to conversations, create a new variable with 'private_channel', and add params 'types' : pvc.

def list(self, exclude_archived=None, exclude_members=None, pvc='private_channel'):
        return self.get('conversations.list',
                        params={'exclude_archived': exclude_archived,
                                'exclude_members': exclude_members, 'types':pvc})
    def history(self, channel, latest=None, oldest=None, count=None,
                inclusive=False, unreads=False):
        return self.get('conversations.history',
                        params={
                            'channel': channel,
                            'latest': latest,
                            'oldest': oldest,
                            'count': count,
                            'inclusive': int(inclusive),
                            'unreads': int(unreads)
                        })

Note: If you edit the code, it not works with public_channel, it is necessary to change the variable.

Thank's

sgratzl commented 5 years ago

have you tried to reproduce the problem in my fork at https://github.com/sgratzl/slack-cleaner ?