Add Reddit Mod Toolbox Removal Reason

Adds a Toolbox removal reason to a Reddit post


Description

Adds a Toolbox removal reason to a Reddit post. Currently only tested on r/ProgrammerHumor, so please test this out in a test subreddit to see if this shortcut is compatible with your toolbox settings before using it.

Warning: This shortcut stores your Reddit access and refresh token in plain text.

Features

  • {kind} token
  • <input>, <textarea>, <select> (if there’s a required attribute it must be before the id attribute)
  • Sets flair on post
  • Comments removal reason and stickies the comment
    • Locks the comment if necessary (according to Toolox settings)

Setup

You’ll probably need a computer for this.

  • Go to https://www.reddit.com/prefs/apps
  • ‘create another app…’ (you may need to scroll down a lot)
    • Select ‘script’
    • Put http://localhost:8080 as the redirect URL
    • Name it whatever you want and create the app
    • The thing under the app name and ‘personal use script’ is the client id. Copy this and the client secret (next to ‘secret’) as you’ll need them later.
  • Put the client id and client secret as the values for client_id and client_secret respectively in the configuration dictionary at the top of the shortcut.

  • Run python3 -m http.server 8080

  • Go to https://www.reddit.com/api/v1/authorize?response_type=code&duration=permanent&redirect_uri=http://localhost:8080&scope=flair+modposts+wikiread&state=abc&client_id=$CLIENT_ID where $CLIENT_ID is your client id
    • Click ‘Allow’
  • Go back to the terminal where you ran the HTTP server. You should see a line like this
::1 - - [04/Jul/2022 16:13:16] "GET /?state=abc&code=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx HTTP/1.1" 200 -

The xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx is the authorisation code. Copy this.

  • Run curl https://www.reddit.com/api/v1/access_token -u $CLIENT_ID:$CLIENT_SECRET -F grant_type=authorization_code -F redirect_uri=http://localhost:8080 -F code=$AUTHORIZATION_CODE

You should get something like

{"access_token": "xxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "token_type": "bearer", "expires_in": 86400, "refresh_token": "xxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "scope": "wikiread modposts flair"}
  • Run this shortcut and put in the values for access_token and refresh_token when prompted.

Latest Release Notes

1.0.0 - Aug. 9, 2022, 4:41 a.m.

Initial release