/pasta

Pretty-paste source code on Slack

Primary LanguagePythonMIT LicenseMIT

Pasta

Pretty-paste source code on Slack

Webguesslang

/paste source code

Pasta is a Slack /command that allow you to past source code directly on channels. The source code is converted into a file and its programming language is automatically detected.

Preview

Install & Run

  • Python 3.6+ required

  • Create your Slack app and tokens https://api.slack.com/:

    • Find Client ID at Basic Information > App Credentials > Client ID

    • and Bot token at OAuth & Permissions > OAuth Tokens & Redirect URLs > Tokens for Your Team > Bot User OAuth Access Token

  • Fill config/tokens.json with your Slack app tokens

  • Install Pasta on your server:

pip3 install .
  • Run Pasta:
pasta-gunicorn
  • You can also provide the tokens as environment variables
PASTA_DEBUG=1 \
  PASTA_BOT_TOKEN="my-bot-user-token" \
  PASTA_CLIENT_ID="my-app-client-id" \
  pasta-gunicorn

Create and run Pasta Docker container

  • Create Pasta container
docker build -t pasta-img .
docker create -p 8000:8000 --name pasta \
  -e PASTA_BOT_TOKEN="my-bot-user-token" \
  -e PASTA_CLIENT_ID="my-app-client-id" \
  pasta-img
  • Start Pasta container
docker start pasta
  • Stop Pasta container
docker stop pasta

License and stuff...