Enter/leave Discord channels automatically when you enter/leave your chair!
Enter/leave a Discord channel automatically when you enter/leave your chair!
A fun (and hopefully helpful) hackathon project to automate something I kept forgetting to do.
This project is obsolete and probably not good to use. Check out https://github.com/reveel-it/sitcord if you’re interested in the continuation of this idea.
You can either set these in your environment like usual, or dotenv
will load them from server/.env
for you.
DISCORD_DEBUG_PORT
- Required. This is the remote debugging port that Discord is listening on. See Enabling Discord Debugging below.DISCORD_SERVER_NAME
- Required. This is the name of the Discord server you want to connect/disconnect to.DISCORD_CHANNEL_NAME
- Defaults to General
. This is the name of the desired voice channel in the above server.SITCORD_PORT
- Defaults to 12345
(because why not!). This is the port you would like you local Sitcord server to listen on. Your ESP32 will connect to this port to send sit/stand statuses.--remote-debugging-port=<PORT>
(more detailed instructions below)server
directory, then run npm install && npm start
Create a new file, include/secrets.h
, and write this in it, putting in your Wi-Fi info:
#include <Arduino.h>
const String serverHost = "http://YOUR_LAN_IP:12345"; // Replace 12345 if you set a custom SITCORD_PORT
const char* ssid = "YOUR_WIFI_SSID_HERE";
const char* password = "YOUR_WIFI_PASSWORD";
You can use any available port for Discord’s debug listener, but whichever one you choose, be sure to set it as DISCORD_DEBUG_PORT
in your environment (or server/.env
file).
If you installed Discord regularly, you should be able to launch Discord from your terminal and pass in arguments like this:
/Applications/Discord.app/Contents/MacOS/Discord --remote-debugging-port=123123
If you use the Discord PTB, the path is only slightly different:
/Applications/Discord\ PTB.app/Contents/MacOS/Discord\ PTB --remote-debugging-port=123123
Now, it isn’t super convenient to launch Discord from terminal every time, especially not if you need to leave the terminal running. So, I recommend creating an Automator Application and giving it one action, Run Shell Script, with a line like this:
/Applications/Discord.app/Contents/MacOS/Discord --remote-debugging-port=123123 > /tmp/discord.log 2> /tmp/discord.err &
That will route Discord’s logs and errors to files in your /tmp
directory, which can be convenient, and it’ll background the process so your Automator script doesn’t have to leave a little spinny gear in your menu bar.
Sorry, I haven’t gotten around to testing this method on other OSes yet, but since the Discord client is an Electron app pretty much everywhere, the process should be basically the same:
--remote-debugging-port
argument with a port of your choiceI grabbed a lot of the DHT-reading code from the example included in Adafruit’s DHT sensor library, so thanks to them for that!