Skip to content

Instantly share code, notes, and snippets.

@jameshd
Created March 9, 2020 15:00
Show Gist options
  • Save jameshd/0b2cc51de99a32c767a1ac20eed5cdcd to your computer and use it in GitHub Desktop.
Save jameshd/0b2cc51de99a32c767a1ac20eed5cdcd to your computer and use it in GitHub Desktop.
Slack Cleaner
#! /bin/bash
# You'll need python and pip installed + a slack token
# https://api.slack.com/legacy/custom-integrations/legacy-tokens
# curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
# python get-pip.py
# pip install slack-cleaner
## READ THE DOCS https://github.com/sgratzl/slack-cleaner
TOKEN=$1
me="my.slackusername"
now=$(date +%y%m%d)
users=(
"a.person"
"another.person"
"onemore.person"
)
for i in "${users[@]}"
do
$(which slack-cleaner) --token $TOKEN --message --user $me --rate 1 --direct $i --before $now --perform
done
chmod +x ./clean.sh
clean.sh <slack-token-here>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment