Skip to content

c0dzilla/luigi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

luigi

luigi

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.

Setup

Setting up luigi is a 2-stage process.

Create credentials

Luigi requires some stuff to communicate with Reddit and Slack:

  1. Clone the repository and copy config.sample.json to config.json.
  2. 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.
  3. 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.
  4. Go to App Preferences in Reddit and create an app. Make sure to select script.
  5. Copy the client id to reddit_client_id and client secret to reddit_client_secret inside config.json.
  6. Finally, enter your reddit username and password in the reddit_username and reddit_password fields inside config.json. Now luigi is all set to serve pastas.

Run luigi

  1. Activate a python virtual environment.
  2. Install python dependencies:
foo@bar:~$ pip install -r requirements.txt
  1. Run the web server:
foo@bar:~$ python server.py

Modes

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.

Usage

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:

random_copypasta

random_copypasta

Acknowledgements

This blog for a quick basic usage example of the Reddit API.

About

Fresh pasta served to your Slack workspace

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages