play4honor / discord_quote_bot

A bot that brings the "quote" feature to Discord.
2 stars 1 forks source link

discord_quote_bot

A bot that brings the "quote" feature to Discord text chat.

To get different versions of this bot, you can pull from Docker Hub:

Quickstart

  1. Install Docker

  2. Pull the image: docker pull cyzhang/discord_quote_bot

  3. Set your authentication token as DISCORD_QUOTEBOT_TOKEN in your environment

    export DISCORD_QUOTEBOT_TOKEN=[token]
  4. Run the image:

    sudo docker run --restart unless-stopped \
    -d -e DISCORD_QUOTEBOT_TOKEN=$DISCORD_QUOTEBOT_TOKEN \
    cyzhang/discord_quote_bot:latest 

Additional Details

Permissions Needed

Deployment

Development Branch

We maintain a fully functioning (hopefully!) development branch. We should test out changes on this branch before merging into the master. To start up the quote-bot-dev bot, follow this set of modified instructions:

  1. Pull the development image: docker pull cyzhang/discord_quote_bot:development
  2. Set your client token as DISCORD_QUOTEBOT_DEV_TOKEN in your environment
  3. Use the Client Token for quote-bot-dev when starting up the docker image

    sudo docker run --restart unless-stopped \
        -d -e DISCORD_QUOTEBOT_TOKEN=$DISCORD_QUOTEBOT_DEV_TOKEN \
        cyzhang/discord_quote_bot:development 

Watchtower

You can use the Watchtower image to automatically re-deploy your bot when there are changes to the docker image. This is useful when you have an auto-deployment pipeline setup. In addition to starting the quotebot images, you should run the watchtower image:

```
docker run -d \
  --name watchtower \
  -v /var/run/docker.sock:/var/run/docker.sock \
  v2tec/watchtower --interval 10 cyzhang/discord_quote_bot cyzhang/discord_quote_bot:development
```

Docker Hub Webhook

See p4h_webhooks for more details.

Overview:

  1. Install Webhook on the deploy machine
    • Make sure you have opened the port that Webhook is going to listen on (e.g., port 9000)
  2. Get the hooks.json and deploy script
    • For the main distribution, clone this repo (here)
  3. Run Webhook in terminal
    sudo -E ~/go/bin/webhook -hooks p4h_webhooks/hooks.json -verbose > p4h_webhooks.log &
  4. Point the webhook in Docker Hub to the deploy machine's endpoint (e.g., http://ec2-[id].compute.amazonaws.com:9000/hooks/redeploy-quotebot/)

Personal Testing Bot

If you want to run a personal version of the bot for testing your own changes, you can do this without using the docker images.

Optional: Use nodemon to develop in a fast interactive loop

Additional Notes: