From 8a09b6f95be02ba15cc97079ad631c8e3fae7f80 Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Wed, 31 May 2023 04:12:17 +0000 Subject: automatic import of python-slack-cleaner2 --- python-slack-cleaner2.spec | 595 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 595 insertions(+) create mode 100644 python-slack-cleaner2.spec (limited to 'python-slack-cleaner2.spec') diff --git a/python-slack-cleaner2.spec b/python-slack-cleaner2.spec new file mode 100644 index 0000000..a6587c8 --- /dev/null +++ b/python-slack-cleaner2.spec @@ -0,0 +1,595 @@ +%global _empty_manifest_terminate_build 0 +Name: python-slack-cleaner2 +Version: 3.2.2 +Release: 1 +Summary: Slack Cleaner2 is an improved slack cleaner version using a python first approach +License: MIT license +URL: https://github.com/sgratzl/slack_cleaner2 +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/db/26/e58becbfcccd0f17384c99cd7aa9b362930ef3ea55bce7b805df05bed2c3/slack_cleaner2-3.2.2.tar.gz +BuildArch: noarch + +Requires: python3-slack-sdk +Requires: python3-colorama +Requires: python3-dateutil +Requires: python3-requests + +%description +# slack_cleaner2 + +[![License: MIT][mit-image]][mit-url] [![Github Actions][github-actions-image]][github-actions-url] [![PyPi][pypi-image]][pypi-url] [![Read the Docs][docs-image]][docs-url] + +Bulk delete messages and files on Slack. + +## Install + +Install from PyPi: + +```sh +pip install slack-cleaner2 +``` + +latest version + +```sh +pip install -e git+https://github.com/sgratzl/slack_cleaner2.git#egg=slack_cleaner2 +``` + +## Usage + +In contrast to the original version (https://github.com/kfei/slack-cleaner) this version is a focusing on pure python package that allows for easy scripting instead of a vast amount of different command line arguments. + +basic usage + +```python +from slack_cleaner2 import * + +s = SlackCleaner('SECRET TOKEN') +# list of users +s.users +# list of all kind of channels +s.conversations + +# delete all messages in -bots channels +for msg in s.msgs(filter(match('.*-bots'), s.conversations)): + # delete messages, its files, and all its replies (thread) + msg.delete(replies=True, files=True) + +# delete all general messages and also iterate over all replies +for msg in s.c.general.msgs(with_replies=True): + msg.delete() +``` + +[Migration Guides form slack-cleaner](https://github.com/sgratzl/slack-cleaner/issues/79) contains a series of common pattern in slack cleaner and their counterpart in Slack Cleaner2 + +## Token + +The slack cleaner needs you to give Slack's API permission to let it run the +operations it needs. You grant these by registering it as an app in the +workspace you want to use it in. + +You can grant these permissions to the app by: + +1. going to [Your Apps](https://api.slack.com/apps) +1. select 'Create New App', fill out an App Name (eg 'Slack Cleaner') and + select the Slack workspace you want to use it in +1. select 'OAuth & Permissions' in the sidebar +1. scroll down to **User Token Scope** and select all scopes you need according to list below +1. select 'Save changes' +1. select 'Install App to Workspace' +1. review the permissions and press 'Authorize' +1. copy the 'OAuth Access Token' shown, and use as the first argument to `SlackCleaner` + +The token should start with **xoxp** and not like bot tokens with **xoxb**. + +Beyond granting permissions, if you wish to use this library to delete +messages or files posted by others, you will need to be an [Owner or +Admin](https://get.slack.help/hc/en-us/articles/218124397-Change-a-member-s-role) of the workspace. + +### User Token Scopes by Use Case + +#### General channel and user detection + +- `users:read` +- `channels:read` +- `groups:read` +- `im:read` +- `mpim:read` + +#### Deleting messages from public channels + +- `users:read` +- `channels:read` +- `channels:history` +- `chat:write` + +#### Deleting messages from private channels + +- `users:read` +- `groups:read` +- `groups:history` +- `chat:write` + +#### Deleting messages from 1:1 IMs + +**Note**: You can only delete your own messages, not the ones of others. This is due to a restriction in the Slack API and there is nothing one can do about it. + +- `im:read` +- `im:history` +- `users:read` +- `chat:write` + +#### Deleting messages from multi-person IMs + +- `mpim:read` +- `mpim:history` +- `users:read` +- `chat:write` + +#### Deleting files + +- `files:read` +- `users:read` +- `files:write` + +### All User Token scopes + +![user token scopes](https://user-images.githubusercontent.com/4129778/81291893-f20b9580-906a-11ea-80a8-f19f3e6878e9.png) + +## Docker + +There is no direct docker file available, however since it is a python module one can easily create one: + +``` +FROM python:3.9-alpine + +LABEL maintainer="Samuel Gratzl " + +VOLUME "/backup" +WORKDIR /backup + +RUN pip --no-cache-dir install slack-cleaner2 + +CMD ["python", "-"] +``` + +An Docker image named `slack_cleaner2` with this Dockerfile would be used like + +```sh +cat myscript.py | docker run -i slack_cleaner2 +``` + +The `myscript.py` file is a python script using the slack_cleaner2 module. + +## Credits + +**To all the people who can only afford a free plan. :cry:** + +## Development + +### Release + +```sh +bumpversion patch +git commit -am 'release vX.X.X' +git tag vX.X.X +invoke release +git push +git push --tags +``` + +change version in `slack_cleaner2/_info.py` + +[mit-image]: https://img.shields.io/badge/License-MIT-yellow.svg +[mit-url]: https://opensource.org/licenses/MIT +[github-actions-image]: https://github.com/sgratzl/slack_cleaner2/workflows/python/badge.svg +[github-actions-url]: https://github.com/sgratzl/slack_cleaner2/actions +[pypi-image]: https://img.shields.io/pypi/v/slack_cleaner2 +[pypi-url]: https://pypi.python.org/pypi/slack_cleaner2/ +[docs-image]: https://readthedocs.org/projects/slack-cleaner2/badge/?version=latest +[docs-url]: https://slack-cleaner2.readthedocs.io/en/latest/?badge=latest + + +%package -n python3-slack-cleaner2 +Summary: Slack Cleaner2 is an improved slack cleaner version using a python first approach +Provides: python-slack-cleaner2 +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-slack-cleaner2 +# slack_cleaner2 + +[![License: MIT][mit-image]][mit-url] [![Github Actions][github-actions-image]][github-actions-url] [![PyPi][pypi-image]][pypi-url] [![Read the Docs][docs-image]][docs-url] + +Bulk delete messages and files on Slack. + +## Install + +Install from PyPi: + +```sh +pip install slack-cleaner2 +``` + +latest version + +```sh +pip install -e git+https://github.com/sgratzl/slack_cleaner2.git#egg=slack_cleaner2 +``` + +## Usage + +In contrast to the original version (https://github.com/kfei/slack-cleaner) this version is a focusing on pure python package that allows for easy scripting instead of a vast amount of different command line arguments. + +basic usage + +```python +from slack_cleaner2 import * + +s = SlackCleaner('SECRET TOKEN') +# list of users +s.users +# list of all kind of channels +s.conversations + +# delete all messages in -bots channels +for msg in s.msgs(filter(match('.*-bots'), s.conversations)): + # delete messages, its files, and all its replies (thread) + msg.delete(replies=True, files=True) + +# delete all general messages and also iterate over all replies +for msg in s.c.general.msgs(with_replies=True): + msg.delete() +``` + +[Migration Guides form slack-cleaner](https://github.com/sgratzl/slack-cleaner/issues/79) contains a series of common pattern in slack cleaner and their counterpart in Slack Cleaner2 + +## Token + +The slack cleaner needs you to give Slack's API permission to let it run the +operations it needs. You grant these by registering it as an app in the +workspace you want to use it in. + +You can grant these permissions to the app by: + +1. going to [Your Apps](https://api.slack.com/apps) +1. select 'Create New App', fill out an App Name (eg 'Slack Cleaner') and + select the Slack workspace you want to use it in +1. select 'OAuth & Permissions' in the sidebar +1. scroll down to **User Token Scope** and select all scopes you need according to list below +1. select 'Save changes' +1. select 'Install App to Workspace' +1. review the permissions and press 'Authorize' +1. copy the 'OAuth Access Token' shown, and use as the first argument to `SlackCleaner` + +The token should start with **xoxp** and not like bot tokens with **xoxb**. + +Beyond granting permissions, if you wish to use this library to delete +messages or files posted by others, you will need to be an [Owner or +Admin](https://get.slack.help/hc/en-us/articles/218124397-Change-a-member-s-role) of the workspace. + +### User Token Scopes by Use Case + +#### General channel and user detection + +- `users:read` +- `channels:read` +- `groups:read` +- `im:read` +- `mpim:read` + +#### Deleting messages from public channels + +- `users:read` +- `channels:read` +- `channels:history` +- `chat:write` + +#### Deleting messages from private channels + +- `users:read` +- `groups:read` +- `groups:history` +- `chat:write` + +#### Deleting messages from 1:1 IMs + +**Note**: You can only delete your own messages, not the ones of others. This is due to a restriction in the Slack API and there is nothing one can do about it. + +- `im:read` +- `im:history` +- `users:read` +- `chat:write` + +#### Deleting messages from multi-person IMs + +- `mpim:read` +- `mpim:history` +- `users:read` +- `chat:write` + +#### Deleting files + +- `files:read` +- `users:read` +- `files:write` + +### All User Token scopes + +![user token scopes](https://user-images.githubusercontent.com/4129778/81291893-f20b9580-906a-11ea-80a8-f19f3e6878e9.png) + +## Docker + +There is no direct docker file available, however since it is a python module one can easily create one: + +``` +FROM python:3.9-alpine + +LABEL maintainer="Samuel Gratzl " + +VOLUME "/backup" +WORKDIR /backup + +RUN pip --no-cache-dir install slack-cleaner2 + +CMD ["python", "-"] +``` + +An Docker image named `slack_cleaner2` with this Dockerfile would be used like + +```sh +cat myscript.py | docker run -i slack_cleaner2 +``` + +The `myscript.py` file is a python script using the slack_cleaner2 module. + +## Credits + +**To all the people who can only afford a free plan. :cry:** + +## Development + +### Release + +```sh +bumpversion patch +git commit -am 'release vX.X.X' +git tag vX.X.X +invoke release +git push +git push --tags +``` + +change version in `slack_cleaner2/_info.py` + +[mit-image]: https://img.shields.io/badge/License-MIT-yellow.svg +[mit-url]: https://opensource.org/licenses/MIT +[github-actions-image]: https://github.com/sgratzl/slack_cleaner2/workflows/python/badge.svg +[github-actions-url]: https://github.com/sgratzl/slack_cleaner2/actions +[pypi-image]: https://img.shields.io/pypi/v/slack_cleaner2 +[pypi-url]: https://pypi.python.org/pypi/slack_cleaner2/ +[docs-image]: https://readthedocs.org/projects/slack-cleaner2/badge/?version=latest +[docs-url]: https://slack-cleaner2.readthedocs.io/en/latest/?badge=latest + + +%package help +Summary: Development documents and examples for slack-cleaner2 +Provides: python3-slack-cleaner2-doc +%description help +# slack_cleaner2 + +[![License: MIT][mit-image]][mit-url] [![Github Actions][github-actions-image]][github-actions-url] [![PyPi][pypi-image]][pypi-url] [![Read the Docs][docs-image]][docs-url] + +Bulk delete messages and files on Slack. + +## Install + +Install from PyPi: + +```sh +pip install slack-cleaner2 +``` + +latest version + +```sh +pip install -e git+https://github.com/sgratzl/slack_cleaner2.git#egg=slack_cleaner2 +``` + +## Usage + +In contrast to the original version (https://github.com/kfei/slack-cleaner) this version is a focusing on pure python package that allows for easy scripting instead of a vast amount of different command line arguments. + +basic usage + +```python +from slack_cleaner2 import * + +s = SlackCleaner('SECRET TOKEN') +# list of users +s.users +# list of all kind of channels +s.conversations + +# delete all messages in -bots channels +for msg in s.msgs(filter(match('.*-bots'), s.conversations)): + # delete messages, its files, and all its replies (thread) + msg.delete(replies=True, files=True) + +# delete all general messages and also iterate over all replies +for msg in s.c.general.msgs(with_replies=True): + msg.delete() +``` + +[Migration Guides form slack-cleaner](https://github.com/sgratzl/slack-cleaner/issues/79) contains a series of common pattern in slack cleaner and their counterpart in Slack Cleaner2 + +## Token + +The slack cleaner needs you to give Slack's API permission to let it run the +operations it needs. You grant these by registering it as an app in the +workspace you want to use it in. + +You can grant these permissions to the app by: + +1. going to [Your Apps](https://api.slack.com/apps) +1. select 'Create New App', fill out an App Name (eg 'Slack Cleaner') and + select the Slack workspace you want to use it in +1. select 'OAuth & Permissions' in the sidebar +1. scroll down to **User Token Scope** and select all scopes you need according to list below +1. select 'Save changes' +1. select 'Install App to Workspace' +1. review the permissions and press 'Authorize' +1. copy the 'OAuth Access Token' shown, and use as the first argument to `SlackCleaner` + +The token should start with **xoxp** and not like bot tokens with **xoxb**. + +Beyond granting permissions, if you wish to use this library to delete +messages or files posted by others, you will need to be an [Owner or +Admin](https://get.slack.help/hc/en-us/articles/218124397-Change-a-member-s-role) of the workspace. + +### User Token Scopes by Use Case + +#### General channel and user detection + +- `users:read` +- `channels:read` +- `groups:read` +- `im:read` +- `mpim:read` + +#### Deleting messages from public channels + +- `users:read` +- `channels:read` +- `channels:history` +- `chat:write` + +#### Deleting messages from private channels + +- `users:read` +- `groups:read` +- `groups:history` +- `chat:write` + +#### Deleting messages from 1:1 IMs + +**Note**: You can only delete your own messages, not the ones of others. This is due to a restriction in the Slack API and there is nothing one can do about it. + +- `im:read` +- `im:history` +- `users:read` +- `chat:write` + +#### Deleting messages from multi-person IMs + +- `mpim:read` +- `mpim:history` +- `users:read` +- `chat:write` + +#### Deleting files + +- `files:read` +- `users:read` +- `files:write` + +### All User Token scopes + +![user token scopes](https://user-images.githubusercontent.com/4129778/81291893-f20b9580-906a-11ea-80a8-f19f3e6878e9.png) + +## Docker + +There is no direct docker file available, however since it is a python module one can easily create one: + +``` +FROM python:3.9-alpine + +LABEL maintainer="Samuel Gratzl " + +VOLUME "/backup" +WORKDIR /backup + +RUN pip --no-cache-dir install slack-cleaner2 + +CMD ["python", "-"] +``` + +An Docker image named `slack_cleaner2` with this Dockerfile would be used like + +```sh +cat myscript.py | docker run -i slack_cleaner2 +``` + +The `myscript.py` file is a python script using the slack_cleaner2 module. + +## Credits + +**To all the people who can only afford a free plan. :cry:** + +## Development + +### Release + +```sh +bumpversion patch +git commit -am 'release vX.X.X' +git tag vX.X.X +invoke release +git push +git push --tags +``` + +change version in `slack_cleaner2/_info.py` + +[mit-image]: https://img.shields.io/badge/License-MIT-yellow.svg +[mit-url]: https://opensource.org/licenses/MIT +[github-actions-image]: https://github.com/sgratzl/slack_cleaner2/workflows/python/badge.svg +[github-actions-url]: https://github.com/sgratzl/slack_cleaner2/actions +[pypi-image]: https://img.shields.io/pypi/v/slack_cleaner2 +[pypi-url]: https://pypi.python.org/pypi/slack_cleaner2/ +[docs-image]: https://readthedocs.org/projects/slack-cleaner2/badge/?version=latest +[docs-url]: https://slack-cleaner2.readthedocs.io/en/latest/?badge=latest + + +%prep +%autosetup -n slack-cleaner2-3.2.2 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-slack-cleaner2 -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed May 31 2023 Python_Bot - 3.2.2-1 +- Package Spec generated -- cgit v1.2.3