Serve fresh copypasta sourced from Reddit to your Slack workspace.
Luigi maintains a local filesystem cache of copypastas that it keeps refreshing from new reddit posts on r/copypasta
. The refresh rate and cache size are configurable (check config.sample.json). To increase the copypasta churn rate, prefer reducing the refresh interval over increasing the cache size.
Note: This is a casual project written as a prototype and not intended for production-level deployments.
Setting up luigi is a 2-stage process.
Luigi requires some stuff to communicate with Reddit and Slack:
- Clone the repository and copy config.sample.json to config.json.
- Create a Slack app(instructions) with the name "luigi". Enable event subscriptions for your app and subscribe to the
app_mention
event. You will need to specify the URL where you plan to run luigi. If you intend to use localhost, use a service like ngrok to tunnel your traffic to localhost through a public-facing URL. Finally, install the app to your workspace. - Copy the Bot User OAuth Token inside Installed App Settings to
slackbot_token
inside config.json. Now luigi is all set to respond to all@
mentions in your workspace. - Go to App Preferences in Reddit and create an app. Make sure to select
script
. - Copy the client id to
reddit_client_id
and client secret toreddit_client_secret
inside config.json. - Finally, enter your reddit username and password in the
reddit_username
andreddit_password
fields inside config.json. Now luigi is all set to serve pastas.
- Activate a python virtual environment.
- Install python dependencies:
foo@bar:~$ pip install -r requirements.txt
- Run the web server:
foo@bar:~$ python server.py
Luigi operates in 2 modes:
- Regular mode: luigi will serve the latest unfiltered copypastas.
- Kiddie mode: luigi will filter the pastas to remove any NSFW content, to the best of its abilities. This is the default setting to avoid any nasty surprises.
To turn off kiddie mode (kudos, btw), set kiddie_mode: false
inside config.json.
Add luigi to a slack channel and mention it. Be prepared for colourful, utterly ridiculous, generally eye-bleach worthy content (especially without kiddie mode). Don't take it too seriously 🙂
Couple of random luigi posts:
This blog for a quick basic usage example of the Reddit API.