Skip to content

Latest commit

 

History

History
48 lines (33 loc) · 2.58 KB

README.md

File metadata and controls

48 lines (33 loc) · 2.58 KB

Habitica dicord bot

A discord bot that listens for Habitica webhooks and sends the info to a discord channel

Installation and usage

Prerequisites

  • Discord bot token with privileged gateway intents. You can follow this guide to obtain it
  • Docker installed on your computer. "But I want to install locally" don't care watch this. You can follow this guide to get docker on your OS

Deployment

Rename .env.example to .env

cp .env.example .env

Fill with your data. For obtaining your userId you can use a webhook tester like this. Put the URL that the web gives you in your webhook section in the Habitica settings. Make any action like complete a task and in the webhook tester search for the field "userID" in the "task" key in the JSON response.

Start the container

docker compose up -d

Invite the bot to your server. You can use this invite link example https://discord.com/api/oauth2/authorize?client_id=CLIENT_ID&permissions=2147601408&scope=applications.commands.permissions.update%20bot%20applications.commands replace CLIENT_ID with your client ID. Execute the command /channel and select which channel you want the bot to send the messages to.

Then you need to go to your Habitica settings and add a webhook URL, if you are hosting locally the format will be http://<your-ip>/webhook. If you are using a reverse proxy like NGINX (Highly recommended because the webhook may not be sent to an insecure URL) you can use this example config

location /webhook {
	proxy_pass http://localhost:1111;
	proxy_http_version 1.1;
	proxy_set_header Upgrade $http_upgrade;
	proxy_set_header Connection 'upgrade';
	proxy_set_header Host $host;
	proxy_cache_bypass $http_upgrade;
	gzip on;
}

In this case the URL would look like this https://<your-domain>/webhook.

As I said I highly recommend configuring an SSL certificate with Let's encrypt, for example

And you are all set. Feel free to fork, pull request and translate the app to your language

Special thanks to my girlfriend AileeNyx who helped me a lot, made the icons for the embeds and gave me most of the ideas. I love you babygirl