*** This project lives @ https://gitlab.rickelobe.com/Bots/R0b3BOT *** [![pipeline status](http://gitlab.rickelobe.com/Bots/r0b3BOT/badges/master/pipeline.svg)](http://gitlab.rickelobe.com/Bots/r0b3BOT/commits/master) # Description This is R0b3's Discord Bot. It's creation was basically a challenge posed a coworker who said "Hey, you can write Discord Bots in Python... Make one to display your 3D printer status!". # Features * Query & Monitor OctoPrint 3D Printer Status using the `$printstat` command (Requires that your printer is connected to [Octoprint](https://octoprint.org/))
![](images/Discord_Printstat_Command.png) * Query & Monitor Bambu Lab Printer Status using the `$bambustat` command (Requires a Bambu Lab printer accessible on the local network via MQTT)
* Displays print state, progress percentage, time remaining, current layer, bed temp, nozzle temp, and chamber temp * Optionally captures and attaches a camera snapshot from the printer's RTSPS stream (requires [ffmpeg](https://ffmpeg.org/) on the host) * Updates the bot's Discord status to show live Bambu print progress while a print is running * Play a selection of sound clips to voice channel members using the various commands (`$torololo`, `$oops`, `$promoted`, etc) # Commands ![Screenshot of $help](images/command_list.png) # Requirements Install all Python dependencies using the provided `requirements.txt`: ``` pip install -r requirements.txt ``` Dependencies: - `discord.py[voice]` >= 2.6.4 — Discord bot framework (voice support included) - `requests` >= 2.32.3 — HTTP client for HomeAssistant REST API calls - `bambu-connect` >= 0.3.1 — Bambu Lab printer integration via local MQTT - `paho-mqtt` >= 2.0 — MQTT client library (required by bambu-connect) **Optional: Camera snapshot support** To enable camera snapshots with `$bambustat`, [ffmpeg](https://ffmpeg.org/) must be installed on the host running the bot. Set `bambu_camera_enable = true` in `bot_config.conf` once ffmpeg is available. # Configuration 1. Create a Discord Bot via the [Discord Developer Portal](https://discord.com/developers/applications) 2. Copy `bot_config.conf.example` to `bot_config.conf` and fill in your values (see below) 3. Rename `octoapi.conf.example` to `octoapi.conf` and configure OctoPrint settings (if using OctoPrint) ## bot_config.conf Keys | Key | Description | |-----|-------------| | `discord_auth_token` | Bot token from the Discord Developer Console | | `bot_command_prefix` | Command prefix (e.g. `$`, `!`, `/`) | | `hass_url` | URL to your Home Assistant instance | | `hass_token` | Long-lived access token for Home Assistant REST API | | `hass_light` | Entity ID of the light at your printer | | `octoprint_ip_address` | IP address of your OctoPrint/OctoPi host | | `bambu_ip_address` | IP address of your Bambu Lab printer on the local network | | `bambu_access_code` | Access code shown on the printer screen (Settings > WLAN) | | `bambu_serial_number` | Serial number of your Bambu Lab printer | | `bambu_camera_enable` | Set to `true` to capture camera snapshots with `$bambustat` (requires ffmpeg) | | `statping_enable` | Set to `true` to enable StatPing service status integration | | `statping_url` | URL of your StatPing instance | | `statping_api_key` | API key for StatPing | | `mmr_checker_enable` | Set to `true` to enable MMR checker | | `mmr_checker_interval` | Seconds between MMR checks | | `mmr_api_url` | MMR API URL |