60 Commits
Author SHA1 Message Date
rich 2d0aeb2a2e Merge branch 'dev' 2026-02-20 18:12:17 -05:00
rich 2476fa9fae adding gitignore 2026-02-20 18:10:39 -05:00
rich bc4854e6f4 updating readme 2026-02-20 18:01:13 -05:00
rich 6362f2558e removing tls_verify option 2026-02-20 17:38:21 -05:00
rich a750628097 adding code to capture ffmpeg errors 2026-02-20 17:35:56 -05:00
rich ce31a2e5df reworking bambu image to get from rtsp stream 2026-02-20 17:27:37 -05:00
rich 570e9d14a6 added option to enable bambu camera retrieval 2026-02-20 16:44:19 -05:00
rich 23fe33e3ad added camera 2026-02-20 16:38:19 -05:00
rich 54c16d81dc fixing the fix for the unconfirmed bug 2026-02-20 16:29:56 -05:00
rich 04d7d5c37f working around unconfirmed bug 2026-02-20 16:27:33 -05:00
rich fbc3ceb3c4 update requirements 2026-02-20 16:23:30 -05:00
rich e1703ae326 adding requirements 2026-02-20 16:19:54 -05:00
rich 65a1fe413d inital commit for adding $bambustat 2026-02-20 16:15:03 -05:00
rich 451938772a more clean up 2026-02-20 15:57:01 -05:00
rich 591d44904e fixing up some issues 2026-02-20 15:48:53 -05:00
rich 84dda24e9d adding discord.py version to $info 2026-02-20 15:00:54 -05:00
rich ebb9865109 reworking 2026-02-20 14:52:12 -05:00
rich e6cf3c6984 fix hanging if octopi is unavailable 2026-02-20 14:47:09 -05:00
rich 01e102af17 clearing voice session before joining channel 2026-02-20 14:42:28 -05:00
rich 790c224dcc using await for 1 second delay 2026-02-20 14:36:51 -05:00
rich 34b80aa274 Merge branch 'master' of https://git.rickelobe.com/rich/r0b3BOT 2026-02-18 19:46:39 -05:00
rich a35be2f669 fixing api woes 2026-02-18 19:43:13 -05:00
rich 06c0f98e25 bringing bot up to date with current discord api 2026-02-18 19:34:03 -05:00
rich 14104b4f39 Discord API now requires INTENTS 2024-03-20 13:29:36 -04:00
rich 1184102860 Added livestream URL to printstat output 2023-02-16 20:13:19 +00:00
rich 4e3d735b1d forgot to replace output variable 2023-02-12 15:47:11 +00:00
rich b074306696 ugh, need ==, not = 2023-02-11 23:13:45 +00:00
rich 0d5fd6c0cf rework time remaining for status 2023-02-11 23:12:34 +00:00
rich 8647451b24 setting to 999 2023-02-11 23:07:41 +00:00
rich c89bfaeff1 retrying leading zero 2023-02-11 19:38:00 +00:00
rich 74f6e0a32c adding leading zero (hopefully) 2023-02-11 19:35:49 +00:00
rich be9173a7ff adding time left to logging output 2023-02-11 19:26:31 +00:00
rich 1666e8fbf9 changeup wording 2023-02-11 19:23:30 +00:00
rich b950886c2d adding time remaining to status 2023-02-11 19:22:10 +00:00
rich 9a627c8a83 remove unused library 2023-02-10 22:51:44 +00:00
rich 9f11775db8 Fix missing paren, add comment explaining need for unknowns 2023-02-10 22:42:44 +00:00
rich d994b9f8fe forgot the f in the f-string 2023-02-10 20:50:50 +00:00
rich a7e5b3bea2 meh, round to tenth place 2023-02-10 20:14:15 +00:00
rich ed2e00ac3c change rounding to whole number 2023-02-10 20:12:53 +00:00
rich 0fd568fd87 minor logging message changes 2023-02-10 20:07:42 +00:00
rich 2801e1559f commenting out few lines that are updating bot status when $printstat is called. No longer need to do this. 2023-02-10 19:56:17 +00:00
rich 3007aa56f5 add message if print job is present but at 100% complete 2023-02-10 19:19:43 +00:00
rich 669333e2c7 dont want to watch print job if it's already at 100% 2023-02-10 19:14:46 +00:00
rich bf88d3d7c1 change location of last_error assignment 2023-02-10 14:48:49 +00:00
rich 3751a29dfb updating logging output 2023-02-10 14:21:23 +00:00
rich 2aae88ed22 forgot await async 2023-02-10 14:19:18 +00:00
rich dc2ea9a7e3 fixing loop 2023-02-10 14:16:43 +00:00
rich 7285c4da85 Adding loop to autodetect 3D printer jobs 2023-02-10 14:09:51 +00:00
rich e0c34659a2 removing references to StatPing and MMR 2023-02-08 23:27:15 +00:00
rich 32bb958ac0 Remove all StatPing and MMR_Checker code 2023-02-08 23:22:36 +00:00
rich 70b721b40f Merge branch 'dev' into 'master'
Merge Dev into Master - minor update

See merge request Bots/r0b3BOT!65
2022-12-10 00:32:04 +00:00
rich a80f62f8d4 fixing some minor bugs 2022-12-10 00:22:15 +00:00
rich a9efb888bd some cleanup and re-org of help command 2022-12-10 00:15:27 +00:00
rich 59fdac5803 added $nice 2022-05-14 00:33:09 +00:00
rich 64173df84d Adding We butter the bread with butter - N!CE 2022-05-14 00:30:00 +00:00
rich 5859bbdac8 updating emote 2022-03-25 01:50:52 +00:00
rich 5b6555b8da adding ascii emote 2022-03-25 01:48:48 +00:00
rich 0e287c369d Added $breee command 2022-03-25 01:36:00 +00:00
rich 98f7ced3bf Adding BREEEEEEEEEEEE 2022-03-25 01:33:06 +00:00
rich dce4303ca1 Merge branch 'testing' into 'dev'
Fixing some stuff & things

See merge request Bots/r0b3BOT!64
2021-04-27 22:36:37 +00:00
8 changed files with 465 additions and 742 deletions

No files matched your search

+2
View File
@@ -1 +1,3 @@
.vscode/launch.json
__pycache__
bot_config.conf
+46 -12
View File
@@ -3,26 +3,60 @@
[![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!". But as time went on, a few more features were added. Aside from being able to query and monitor your 3D printer, it can also fetch the current status of a service monitroed by your [StatPing](https://github.com/statping/statping) instance. In addition to just fetching the current status of a service, you can subscribe to receive alerts for any StatPing service state change. All subscriptions are persistent and will remain even after the bot is restarted.
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 3D Printer Status using `$printstat` command(Requires that your printer is connected to [Octoprint](https://octoprint.org/))<br>
* Query & Monitor OctoPrint 3D Printer Status using the `$printstat` command (Requires that your printer is connected to [Octoprint](https://octoprint.org/))<br>
![](images/Discord_Printstat_Command.png)
* Query serivces states on StatPing using the `$spstatus`
* Use `$spsub` to "Subscribe" to service change alerts for StatPing services. Subscribed alerts are persistent and are not lost on bot restart.<br>
![Example service alert](images/Service_alert.png)
* Use `$mmrsub` to "Subscribe" to a League of Legends handle's Ranked Average. As with the StatPing feature, the subscriptions are persistent.
* Query & Monitor Bambu Lab Printer Status using the `$bambustat` command (Requires a Bambu Lab printer accessible on the local network via MQTT)<br>
* 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
1. discord.py version 1.2.4 or greater<br>
<code> pip install discord.py </code>
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 Developer tools<br>
2. Enter configuration parameters in bot_config.conf.example<br>
3. Enter OctoPrint config parameters in octoapi.conf.example<br>
4. Rename *.example files as *.conf and setup your config<br>
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 |
+25
View File
@@ -0,0 +1,25 @@
[bot-config]
#
# Replace the placeholders with your information. Do not use quotes.
#
# discord_auth_token - this is the bot token generated via the Discord development console.
# bot_command_prefix - The prefix used identify commands for this bot
# hass_url - URL to your home assistant instance. This is used to turn on the light by your 3d printer
# hass_token - Long Lived Access Token used to authenticate with the REST API for your Home assistant instance
# hass_light - Entity name of the light you want to control
# octoprint_ip_address - IP Address of you OctoPrint (or OctoPi) host. Used to get 3D printer stats.
# statping_url - Server hostname of the StatPing instance we will be querying w/ the REST API
# statping_api_key - API Key for Statping to query for service status
#
discord_auth_token = Njk4NTY1MDM5MzAwNDExNDIy.XpHrZA.QCXjDj_Sk36Ohtu8ryXKSoGKMkc
bot_command_prefix = #
hass_url = <URL to HomeAssistant>
hass_token = <HomeAssistant Long Lived Access Token>
hass_light = <Entity_ID of the light @ your printer>
octoprint_ip_address = <OctoPrint IP Address>
statping_enable = False
statping_url = <Statping URL>
statping_api_key = <Statping API Key>
mmr_checker_enable = True
mmr_checker_interval = 600
mmr_api_url = https://na.whatismymmr.com/api/v1/summoner?name=
+10 -1
View File
@@ -7,7 +7,12 @@
# hass_url - URL to your home assistant instance. This is used to turn on the light by your 3d printer
# hass_token - Long Lived Access Token used to authenticate with the REST API for your Home assistant instance
# hass_light - Entity name of the light you want to control
# octoprint_ip_address - IP Address of you OctoPrint (or OctoPi) host. Used to get 3D printer stats.
# octoprint_ip_address - IP Address of you OctoPrint (or OctoPi) host. Used to get 3D printer stats.
# bambu_ip_address - IP Address of your Bambu Lab printer on the local network
# bambu_access_code - Access code displayed on the printer's screen (Settings > WLAN)
# bambu_serial_number - Serial number of your Bambu Lab printer
# bambu_camera_enable - Set to true to capture a camera snapshot with $bambustat via ffmpeg RTSPS stream.
# Requires ffmpeg to be installed on the bot host.
# statping_url - Server hostname of the StatPing instance we will be querying w/ the REST API
# statping_api_key - API Key for Statping to query for service status
#
@@ -17,6 +22,10 @@ hass_url = <URL to HomeAssistant>
hass_token = <HomeAssistant Long Lived Access Token>
hass_light = <Entity_ID of the light @ your printer>
octoprint_ip_address = <OctoPrint IP Address>
bambu_ip_address = <Bambu Lab Printer IP Address>
bambu_access_code = <Bambu Lab Access Code>
bambu_serial_number = <Bambu Lab Serial Number>
bambu_camera_enable = false
statping_enable = <trues/false>
statping_url = <Statping URL>
statping_api_key = <Statping API Key>
+369 -729
View File
File diff suppressed because it is too large. Load diff
+13
View File
@@ -0,0 +1,13 @@
# r0b3BOT Python dependencies
# Install with: pip install -r requirements.txt
# Discord bot framework — [voice] pulls in PyNaCl for voice channel encryption
discord.py[voice]>=2.6.4
# HTTP client — used for HomeAssistant REST API calls
requests>=2.32.3
# Bambu Lab printer integration via local MQTT
# bambu-connect 0.3.1 uses mqtt.CallbackAPIVersion.VERSION1, which requires paho-mqtt 2.x
bambu-connect>=0.3.1
paho-mqtt>=2.0
Binary file not shown.
Binary file not shown.