329 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
rich 1153d1919c fixing indents 2021-04-04 15:01:48 -04:00
rich 499d86459b Merge branch 'testing' of https://gitlab.rickelobe.com/Bots/r0b3BOT into testing 2021-04-04 14:54:55 -04:00
rich c053b58733 not properly handling non jason response 2021-04-04 14:54:38 -04:00
rich e018cfa05b Merge branch 'master' of https://gitlab.rickelobe.com/Bots/r0b3BOT into testing 2021-03-23 19:11:00 -04:00
rich 9f58177559 Merge branch 'dev' into 'master'
Bring in fix for displaying correct version number

See merge request Bots/r0b3BOT!63
2021-03-22 14:40:18 +00:00
rich 58e1781397 correctly fixing the version now (wish the documentation was better) 2021-03-22 00:10:35 +00:00
rich f08eb06db4 Fixing the version information displayed for the info command 2021-03-22 00:06:43 +00:00
rich 807bf17f61 Merge branch 'dev' into 'master'
Merge MMR checker into master for release

See merge request Bots/r0b3BOT!62
2021-03-21 23:42:04 +00:00
rich 3e354d3655 Merge MMR checker into master for release 2021-03-21 23:42:04 +00:00
rich fa38734869 Merge branch 'testing' into 'dev'
Merge MMR Checker into Dev

See merge request Bots/r0b3BOT!61
2021-03-21 23:29:08 +00:00
rich 66ed4fd4d1 Merge MMR Checker into Dev 2021-03-21 23:29:07 +00:00
rich c528e0f638 Added new feature 2021-03-21 17:19:27 +00:00
rich 41b1c73ff3 adding back bot.remove_command entry 2021-03-21 13:10:16 -04:00
rich b1d1a7b1cc Cleanup of code 2021-03-21 13:07:25 -04:00
rich 8bb132be24 Organizing 2021-03-21 12:44:49 -04:00
rich 15d0a01dcb typo 2021-03-21 12:37:56 -04:00
rich ad05b2f427 updating help command details 2021-03-21 12:37:20 -04:00
rich 2cbaef99c0 working on mmrstatus 2021-03-21 12:26:25 -04:00
rich a53cab8343 working on mmrstatus 2021-03-21 12:24:03 -04:00
rich e00da20870 Cleaning up output text 2021-03-21 12:17:00 -04:00
rich 45d8d5702c found typo 2021-03-21 12:11:24 -04:00
rich 86e7944837 editing output for clarity 2021-03-21 12:05:31 -04:00
rich e9a2165f78 found some issues 2021-03-21 11:41:45 -04:00
rich 9421b22cff was using wrong varibale... missed ong 2021-03-21 07:54:10 -04:00
rich 5767d2d606 was using wrong varibale 2021-03-21 07:53:06 -04:00
rich 3b5ecf4b6b more debug 2021-03-21 07:46:56 -04:00
rich d961698d40 typo 2021-03-21 07:45:15 -04:00
rich 37e9512d82 troubleshooting -list command 2021-03-21 07:44:27 -04:00
rich 5e1164d98c typo 2021-03-20 19:25:50 -04:00
rich 1e64e992dd let's try it this way 2021-03-20 19:25:05 -04:00
rich 667126c916 dunno 2021-03-20 19:18:31 -04:00
rich 5ada6cfb36 troubleshooting response check: welp, had that backwards 2021-03-20 19:13:08 -04:00
rich b6d5ce6836 troubleshooting response check: fixing syntax 2021-03-20 19:11:16 -04:00
rich 0077f1a80b troubleshooting response check 2021-03-20 19:09:34 -04:00
rich dfa82dbe96 correcting variable being used 2021-03-20 19:06:59 -04:00
rich ba014f4c98 fixing... 2021-03-20 19:05:27 -04:00
rich 6823161897 fixing... 2021-03-20 19:03:52 -04:00
rich fcb0051c87 fixing 2021-03-20 19:03:15 -04:00
rich 403aa9a362 check if handle was actually found 2021-03-20 19:00:42 -04:00
rich 8d91336b43 Added mmrstatus command 2021-03-20 18:31:41 -04:00
rich 25abfb2a59 updating info command 2021-03-20 18:23:30 -04:00
rich 3f9a976742 clarifying alert text 2021-03-20 17:17:49 -04:00
rich 8f41991a3d fixing assignment again... hopefully for the last time, again 2021-03-20 16:31:09 -04:00
rich 1785162cea fixing assignment again... hopefully for the last time 2021-03-20 16:30:15 -04:00
rich 0207424d32 fixing assignment again 2021-03-20 16:28:50 -04:00
rich ab7009e43f fixing assignment 2021-03-20 16:25:36 -04:00
rich 5c0e61d466 adding newlines 2021-03-20 12:51:43 -04:00
rich 2cabbbf6f1 more tweaks to output 2021-03-20 12:49:19 -04:00
rich 803e8d552d more tweaks to output 2021-03-20 12:48:19 -04:00
rich 0950092f6d more tweaks to output 2021-03-20 12:46:47 -04:00
rich f6e15d9c35 output formatting 2021-03-20 12:38:21 -04:00
rich 5b917e032f fixing minor typo 2021-03-20 12:16:36 -04:00
rich 7628f8d1ae setting variable to int 2021-03-20 12:14:52 -04:00
rich 1e496efbee added interval option for mmr checker, cleaned up some output 2021-03-20 12:11:30 -04:00
rich 0cf348570b tweaks 2021-03-20 11:39:17 -04:00
rich 55419dbafb correcting syntax error 2021-03-20 10:03:45 -04:00
rich cf3757ce11 added enable/disable check before starting mmr checker and statping monitor 2021-03-20 10:02:08 -04:00
rich 4cf45b2684 added enable/disable options for mmr checker and statping monitor 2021-03-20 10:01:34 -04:00
rich 544f7b5833 I think all of the necessary changes have been made to add the mmr checker... needs to test now? 2021-03-19 22:43:02 -04:00
rich fa2a34c951 adding mmr api variable 2021-03-19 22:24:04 -04:00
rich affbf366a1 adding base code for mmr_checker 2021-02-14 21:37:17 -05:00
rich 4056f60cd8 duplicated statping functions for mmr monitor 2021-01-20 21:55:42 -05:00
rich a7a36f123c Merge branch 'dev' of https://gitlab.rickelobe.com/Bots/r0b3BOT into mmr_checker 2021-01-20 21:27:43 -05:00
rich 6865041707 Added missing playtime value for rs command 2020-09-02 09:47:06 -04:00
rich 520758e2f2 Added Wiz Khalifa clip $big 2020-07-01 09:10:58 -04:00
rich cd74624747 added iran sound clip 2020-07-01 08:58:15 -04:00
rich 525f13b3e8 Merge branch 'dev' into 'master'
changing play delay to check if file is still being played

See merge request Bots/r0b3BOT!60
2020-06-22 11:36:18 -04:00
rich c82dc32ca2 changing play delay to check if file is still being played 2020-06-19 11:42:37 -04:00
rich ccb260c3f9 Merge branch 'master' into 'testing'
Make testing master again!

See merge request Bots/r0b3BOT!59
2020-04-15 15:27:09 -04:00
rich fa9fb6b27d Merge branch 'dev' into 'master'
Version 0.3

See merge request Bots/r0b3BOT!58
2020-04-15 15:09:06 -04:00
rich b222b2342e Update README.md - added links to octoprint and statping pages 2020-04-15 15:05:43 -04:00
rich a0d5c63aee moved image 2020-04-15 14:56:58 -04:00
rich 0976c2c9e3 Update README.md 2020-04-15 14:55:40 -04:00
rich 82647b2597 Screenshot of command list 2020-04-15 14:53:58 -04:00
rich e20ac2c849 Update README.md 2020-04-15 14:53:12 -04:00
rich 37a689e58e added screenshot of service alert 2020-04-15 14:46:01 -04:00
rich 79043feb91 Upload screenshot of service alert 2020-04-15 14:44:40 -04:00
rich c2f905229f Updated README.md, listing more features 2020-04-15 14:43:31 -04:00
rich 114e6aeb9b Merge branch 'testing' into 'dev'
Merge changes to fix Issue #8

See merge request Bots/r0b3BOT!57
2020-04-14 22:02:58 -04:00
rich 83f7270d6b updated help message 2020-04-14 21:59:10 -04:00
rich 63602bc19c wasnt saving the result, doh 2020-04-14 21:57:31 -04:00
rich 65a608395b adding code to allow inserting _ in place of spaces and will revert 2020-04-14 21:55:00 -04:00
rich f11c076258 trying removal of print statement 2020-04-14 21:52:41 -04:00
rich 7b7f57f4c0 trying more ' 2020-04-14 21:50:55 -04:00
rich e2c100c5bb removing " from service variable 2020-04-14 21:48:16 -04:00
rich 57e5c37f1a Merge branch 'testing' into 'dev'
changed channel to currentsub_req[1]

See merge request Bots/r0b3BOT!56
2020-04-14 21:24:36 -04:00
rich d53cc3b3f6 changed channel to currentsub_req[1] 2020-04-14 21:18:00 -04:00
rich fc7ef5eb69 Merge branch 'testing' into 'dev'
testing changes ready for dev

See merge request Bots/r0b3BOT!54
2020-04-14 20:48:21 -04:00
rich ccba129bb2 Merge branch '7-info-should-list-a-version-identifier' into 'testing'
Resolve "$info should list a version identifier"

See merge request Bots/r0b3BOT!53
2020-04-14 20:46:45 -04:00
rich d9f52bdafd Merge branch 'testing' into 'dev'
testing of version information completed, merge into dev

See merge request Bots/r0b3BOT!52
2020-04-14 20:40:23 -04:00
rich f0615c51e8 Merge branch '7-info-should-list-a-version-identifier-2' into 'testing'
Resolve "$info should list a version identifier"

See merge request Bots/r0b3BOT!51
2020-04-14 20:37:19 -04:00
rich 6deb4455ed minor console output text change 2020-04-14 20:31:37 -04:00
rich 86d7e414c2 forgot {} 2020-04-14 20:27:40 -04:00
rich 19304b5d27 adding version to info command 2020-04-14 20:23:42 -04:00
rich f87a07f6bd Merge branch 'testing' into 'dev'
Fixed redundant Statping Monitor starts

See merge request Bots/r0b3BOT!50
2020-04-14 13:38:15 -04:00
rich 6b3490557c move start of statping monitor out from bot.on_ready. Think it was being start multiple times when bot reconnected to discord. 2020-04-14 13:38:15 -04:00
rich 006468bd35 Merge branch 'dev' into 'testing'
# Conflicts:
#   r0b3bot.py
2020-04-14 13:37:43 -04:00
rich 2cf516dd1f move notice of statping mon start 2020-04-14 13:29:16 -04:00
rich 0467fde122 missing attribute 2020-04-14 13:27:35 -04:00
rich d9362fb819 rearrange to fix 2020-04-14 13:22:50 -04:00
rich b165e67676 update 2020-04-14 13:20:52 -04:00
rich 1dc54fa5f2 testing output 2020-04-14 13:19:33 -04:00
rich 91063db833 change criteria 2020-04-14 13:15:43 -04:00
rich c9f2d07f4b syntax 2020-04-14 13:12:59 -04:00
rich 290bdc3903 adding debug output 2020-04-14 13:12:27 -04:00
rich 93734ec773 pemdas 2020-04-14 13:11:14 -04:00
rich 37a6b08fe2 changed logic 2020-04-14 13:07:39 -04:00
rich f1e35bae27 added sleep 2020-04-14 12:57:40 -04:00
rich 5c2b426748 moving 2020-04-14 12:56:10 -04:00
rich ed6606f8ac case? 2020-04-14 12:54:30 -04:00
rich be4b46a81d changed to global, though I dont think that's the cause of the issue 2020-04-14 12:52:52 -04:00
rich f0c65454d3 moved start of statping monitor back to on_ready, but am now checking started state variable. 2020-04-14 09:01:19 -04:00
rich 646081286f move start of statping monitor out from bot.on_ready. Think it was being start multiple times when bot reconnected to discord. 2020-04-14 08:47:07 -04:00
rich e36d8727c5 added print statements for sending alerts 2020-04-14 08:39:16 -04:00
rich e8cf0f2c24 Merge branch 'testing' into 'dev'
Testing

See merge request Bots/r0b3BOT!48
2020-04-13 22:42:40 -04:00
rich cd4b3bbb38 Testing 2020-04-13 22:42:40 -04:00
rich 2a5ced954b added new commands to help 2020-04-13 22:39:19 -04:00
rich ea2a76bf81 adding breaks 2020-04-13 22:30:09 -04:00
rich 1be2590f43 adding another break 2020-04-13 22:09:54 -04:00
rich f37fc95ddc added break 2020-04-13 22:07:37 -04:00
rich 2515eb83a5 changed when assigning service name 2020-04-13 22:04:34 -04:00
rich 47e5c364a9 calling wrong variable 2020-04-13 22:00:46 -04:00
rich a03efbd2a9 fix indent 2020-04-13 21:59:24 -04:00
rich d49d368895 saving updated file 2020-04-13 21:58:55 -04:00
rich ba792ff1f5 moving indent out 2020-04-13 21:57:15 -04:00
rich faad238f8c fix wrong vairable assignment 2020-04-13 21:54:43 -04:00
rich cc1368258c fixing typo 2020-04-13 21:53:10 -04:00
rich 7c1b3c207d changing option 2020-04-13 21:51:55 -04:00
rich 8f9af7d10c addd -del option 2020-04-13 21:48:57 -04:00
rich 4ec07fdf77 changed info command prefix to variable 2020-04-13 21:34:45 -04:00
rich 7e9be22734 changed spalert to spstatus 2020-04-13 21:32:31 -04:00
rich d85149e5f1 seriously if this was it... ugh 2020-04-13 21:29:41 -04:00
rich 0e393b089f typo 2020-04-13 21:25:32 -04:00
rich c16fb46b78 does this work? 2020-04-13 21:24:13 -04:00
rich f051fe0087 undo 2020-04-13 21:20:01 -04:00
rich bf2ac43a88 typo 2020-04-13 21:18:50 -04:00
rich 87f82af697 ugh 2020-04-13 21:18:17 -04:00
rich 9036557154 trying a different method 2020-04-13 21:08:32 -04:00
rich c9c67f32c9 typo? 2020-04-13 21:05:53 -04:00
rich cc90375376 using .update to append 2020-04-13 21:05:02 -04:00
rich 6df3f8a55f doing it wrong 2020-04-13 21:01:16 -04:00
rich 0bf0134a86 changin variable 2020-04-13 20:59:54 -04:00
rich 576f21b6fc was not handling when serivce was not present in file 2020-04-13 20:58:36 -04:00
rich 824c952ad9 moved statement outside of loop 2020-04-13 20:54:17 -04:00
rich eeae88595d adding more console output 2020-04-13 20:52:30 -04:00
rich a709f25ea3 added consonle output 2020-04-13 20:48:37 -04:00
rich 4c43ab0e8e added placeholder 2020-04-13 20:44:33 -04:00
rich d97a2d1fe3 need to query before use 2020-04-13 20:43:51 -04:00
rich 10baa139a1 fix statement 2020-04-13 20:39:35 -04:00
rich be04db6237 fixing indents 2020-04-13 20:39:06 -04:00
rich ce319f8696 added spsub- list 2020-04-13 20:38:29 -04:00
rich b26139fdac fixing append of channel id 2020-04-13 20:13:41 -04:00
rich 98cf67381b adding response 2020-04-13 20:07:28 -04:00
rich 132267f5d4 adding more console output, fixed missing ' 2020-04-13 20:05:03 -04:00
rich 1a204d303b fixing iteration 2020-04-13 20:02:47 -04:00
rich f82227ea0d adding notice to channel of duplicate 2020-04-13 19:57:56 -04:00
rich 238bb9f5ea fixing dict creation 2020-04-13 19:55:48 -04:00
rich f026c88817 change how saving channel 2020-04-13 19:00:27 -04:00
rich fa2fb34e41 moved print 2020-04-13 18:56:24 -04:00
rich 85cf5f5ce5 added confirmation message 2020-04-13 18:53:08 -04:00
rich 1e62920925 typo 2020-04-13 18:51:09 -04:00
rich d58c7245e7 clearing up console output 2020-04-13 18:50:25 -04:00
rich 861397b455 fixing append 2020-04-13 18:41:11 -04:00
rich a265de4a62 fixing typo 2020-04-13 18:34:44 -04:00
rich d9883b6f97 fixing iteration 2020-04-13 18:33:45 -04:00
rich 64d80c79ac change to ctx.channel 2020-04-13 18:31:11 -04:00
rich 91def4cd4d working on fixing iterations 2020-04-13 18:26:47 -04:00
rich 6a46983293 changed wording for clarity 2020-04-13 18:23:09 -04:00
rich 0544d870e7 fixed call 2020-04-13 18:22:27 -04:00
rich e1327961b6 fixed 2020-04-13 18:19:44 -04:00
rich 153bc39e63 moved to single line 2020-04-13 18:18:38 -04:00
rich f94f69aa59 change debug 2020-04-13 18:10:38 -04:00
rich 9dfae705e5 now accounting for status not found response 2020-04-13 17:23:42 -04:00
rich 32144c5657 fixed comparison 2020-04-13 17:18:52 -04:00
rich 5235df2259 init status 2020-04-13 17:08:58 -04:00
rich eca6fae897 removed use of new_ 2020-04-13 17:04:48 -04:00
rich 1e58d5017d adding debug 2020-04-13 16:59:14 -04:00
rich 75121c5a79 printing status varibale 2020-04-13 16:28:56 -04:00
rich 71231d3a9b testing variable 2020-04-13 16:24:56 -04:00
rich 3b6c82d6f5 fixed iteration 2020-04-13 16:19:14 -04:00
rich 1fc96f6b3a adding debug print 2020-04-13 16:17:00 -04:00
rich c7216563e6 changing assignment type 2020-04-12 23:56:36 -04:00
rich 4a27acb4ac updated for loop 2020-04-12 23:53:42 -04:00
rich e0d77bf82d forgot closing ] 2020-04-12 23:49:50 -04:00
rich 84e6f8ed6d changing assignment 2020-04-12 23:49:02 -04:00
rich 67309f5925 adding debug output 2020-04-12 23:45:26 -04:00
rich 8480215db9 changing assignment 2020-04-12 23:43:16 -04:00
rich 7bab9a1238 setting protocol to 4 2020-04-12 23:38:56 -04:00
rich e08621d317 saving pickled dict 2020-04-12 23:38:09 -04:00
rich 204acac19c now adding key 2020-04-12 23:35:07 -04:00
rich 077e82bda2 reworked StatPing_Montor to use dict 2020-04-12 23:28:05 -04:00
rich 9af4a52927 reqrote spsub_T to use/create a nested dictionary 2020-04-12 23:11:49 -04:00
rich 2970adc634 using pickle again 2020-04-12 21:08:47 -04:00
rich a95b88d99f no bytes 2020-04-12 20:52:14 -04:00
rich 3832d13200 saving just channel id and now appending 2020-04-12 20:50:38 -04:00
rich ca06fea13f trying different library 2020-04-12 15:28:06 -04:00
rich 5575dbb054 case update 2020-04-12 15:18:45 -04:00
rich 8d02152697 more typo fixes 2020-04-12 15:16:54 -04:00
rich ae601c45f5 typo 2020-04-12 15:15:52 -04:00
rich 7391e68778 replace pickle with aiofile 2020-04-12 15:14:12 -04:00
rich 0f607f67ee more awaits? 2020-04-12 15:04:55 -04:00
rich 142a7fcf48 forgot awaits 2020-04-12 14:59:07 -04:00
rich 2ef6cf6053 Added new test functions to read in spsubs from file 2020-04-12 14:54:35 -04:00
rich dd0dbb0f27 formatting 2020-04-12 11:13:56 -04:00
rich f85a637566 added read in of command prefix and updated bot creation to use config. Also moved bot object creation to after read in of prefix config 2020-04-11 12:20:09 -04:00
rich bb711b8167 fixed missing ' in console output 2020-04-11 12:15:34 -04:00
rich 9f4ee76bb7 added bot_command_prefix to config file 2020-04-11 12:15:13 -04:00
rich 4464d589d9 change notices to embed w/ color 2020-04-10 14:26:09 -04:00
rich de815af682 wording changes 2020-04-10 14:12:33 -04:00
rich 46dc4190a0 added send to channel notifying service is now being monitored 2020-04-10 14:11:10 -04:00
rich c8414ba000 replaced sleep w/ more friendly versions 2020-04-10 14:07:45 -04:00
rich 9eaf1d8029 added some console outputs 2020-04-10 14:02:59 -04:00
rich b26af574ae fixed variable name 2020-04-10 13:24:51 -04:00
rich 51692a17db should probably rework this if elif statements 2020-04-10 13:22:13 -04:00
rich b90b5fc8f4 type 2020-04-10 13:20:13 -04:00
rich 6e0642a11b cant assign when declaring 2020-04-10 13:19:27 -04:00
rich fba8cc680c initial test of alert subscriptions 2020-04-10 13:15:59 -04:00
rich 1547784a40 removed ctx 2020-04-10 12:12:51 -04:00
rich 3b65435899 moving outside of loop 2020-04-10 12:10:57 -04:00
rich bd98d1bdcb more reworking of functions for future needs 2020-04-10 12:08:16 -04:00
rich d946067bd4 forgot await 2020-04-10 11:51:30 -04:00
rich d15267ea53 reworking functions 2020-04-10 11:49:43 -04:00
rich 05b7520a3f help text grammar 2020-04-09 23:56:36 -04:00
rich f8e04ea086 for mendo 2020-04-09 23:50:43 -04:00
rich e594d27beb removed uptime command and added spalert to $help 2020-04-09 23:40:19 -04:00
rich 427937e8d5 added $ hint in status 2020-04-09 23:37:50 -04:00
rich ff189b7357 added reply if service was not found 2020-04-09 23:26:57 -04:00
rich 92542b4405 code cleanup 2020-04-09 23:23:25 -04:00
rich 351fb9c090 commenting out debug 2020-04-09 23:13:28 -04:00
rich af6862dfe5 forgot : 2020-04-09 23:12:52 -04:00
rich 4e562c5c66 reworked if else statements 2020-04-09 23:12:31 -04:00
rich 25d0aad3cb fixed indent 2020-04-09 23:07:35 -04:00
rich 82743a0d66 dump status of all services 2020-04-09 23:06:24 -04:00
rich ce51483344 remove empty send 2020-04-09 23:05:33 -04:00
rich 40806125a5 added send for debug 2020-04-09 22:59:19 -04:00
rich bb33e9f82b moved to beginning of cmd 2020-04-09 22:54:01 -04:00
rich 7fdbcdf951 assigning properly 2020-04-09 22:52:26 -04:00
rich 369b3bf867 didnt mean to remove this 2020-04-09 22:51:11 -04:00
rich b62f864167 change back to break added spalert value to else 2020-04-09 22:49:33 -04:00
rich 5b748dc207 return 2020-04-09 22:45:54 -04:00
rich cbf96086d3 added break in for loop 2020-04-09 22:43:57 -04:00
rich 29b7cd93da .json() 2020-04-09 22:42:44 -04:00
rich 7987fe186a added .json() 2020-04-09 22:39:42 -04:00
rich 3fd8c5de0e removed slash 2020-04-09 22:33:27 -04:00
rich 82fda0be94 added contenty type 2020-04-09 22:32:37 -04:00
rich 3f9cbf8964 commented json load 2020-04-09 22:30:16 -04:00
rich d86f634827 dump to separate line 2020-04-09 22:26:31 -04:00
rich 82b08ce80b extra ) removed 2020-04-09 22:24:56 -04:00
rich 7015ac4f7e dumping json to channel for debug 2020-04-09 22:24:15 -04:00
rich bf8a306870 making global? 2020-04-09 22:20:22 -04:00
rich 2a3fc39da6 loading as json 2020-04-09 22:17:35 -04:00
rich 079770da7b corrected variable name 2020-04-09 22:15:07 -04:00
rich cabf2d3ba8 added await to cmd call 2020-04-09 22:13:09 -04:00
rich 9f8864683d fixed incorrect variable call 2020-04-09 22:09:57 -04:00
rich 56685916f0 fixed typo 2020-04-09 22:08:25 -04:00
rich 991e0f2429 ugh this is shameful, another syntax issue 2020-04-09 22:07:26 -04:00
rich 89235209e1 fixed yet another syntax error else if to elif 2020-04-09 22:06:16 -04:00
rich 66ff3375ff fixed unexpected indent 2020-04-09 22:04:47 -04:00
rich 993adfc196 fixed typo 2020-04-09 22:03:17 -04:00
rich fdbe058c2a Adding ability to query statping for service status 2020-04-09 22:00:04 -04:00
rich 4471e5930d Change server to url 2020-04-09 21:27:41 -04:00
rich 1c7c739942 added statping_server as a config variable 2020-04-07 21:01:19 -04:00
rich 0a7eec666d added comment for statping api key 2020-04-07 17:17:12 -04:00
rich 41c640ca10 Added statping API key variables 2020-04-07 17:12:09 -04:00
rich 2e961db66f added $heavy command 2020-03-30 21:24:09 -04:00
rich c0d817fb69 Added yaw command 2020-03-30 21:01:26 -04:00
rich 6d1b82d3c3 added uptime to $info command 2020-03-30 12:38:22 -04:00
rich 8805587576 add gitlab link to $info command 2020-03-29 19:00:46 -04:00
rich a8e62c5ce9 Merge branch 'dev' into 'master'
Version 0.2

See merge request Bots/r0b3BOT!47
2020-03-29 18:20:14 -04:00
15 changed files with 583 additions and 142 deletions

No files matched your search

Vendored
BIN
View File
Binary file not shown.
+2
View File
@@ -1 +1,3 @@
.vscode/launch.json
__pycache__
bot_config.conf
+52 -9
View File
@@ -2,18 +2,61 @@
[![pipeline status](http://gitlab.rickelobe.com/Bots/r0b3BOT/badges/master/pipeline.svg)](http://gitlab.rickelobe.com/Bots/r0b3BOT/commits/master)
# Screenshot
![](images/Discord_Printstat_Command.png)
# 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/))<br>
![](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)<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 various configuration parameters in bot_config.conf.example<br>
3. Enter OctoPrint config parameters in octoapi.conf.example<br>
4. Rename *.example files as *.conf<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=
+20 -2
View File
@@ -3,14 +3,32 @@
# 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.
# 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
#
discord_auth_token = <Discord Auth Token>
bot_command_prefix = <!/$/#/etc>
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>
mmr_checker_enable = <true/false>
mmr_checker_interval = <number of seconds between checks>
mmr_api_url = <MMR API URL>
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 KiB

+471 -131
View File
@@ -1,40 +1,63 @@
#!/usr/bin/python3
import discord
from discord.ext import commands
from discord.ext import commands, tasks
from datetime import datetime
import urllib.request
import random
import os
import sys
import octoapi
import time
from datetime import datetime
import configparser
import json
from discord import FFmpegPCMAudio
from discord.utils import get
from discord.voice_client import VoiceClient
import requests
import asyncio
from bambu_connect import BambuClient
bot = commands.Bot(command_prefix='$', description='A derpy derp of a bot.')
# Monkey-patch every dataclass in bambu-connect's models module to tolerate
# unknown fields. The Bambu printer firmware sends extra keys that the
# bambu-connect 0.3.1 models don't define (e.g. Upload.file_size,
# Online.ext), causing TypeErrors that crash the MQTT thread.
# Filtering kwargs to known fields before calling the original __init__
# fixes this for all nested classes at once.
import dataclasses as _dc
import inspect as _inspect
from bambu_connect.utils import models as _bambu_models
def _make_permissive(cls):
known = {f.name for f in _dc.fields(cls)}
orig = cls.__init__
def __init__(self, **kwargs):
orig(self, **{k: v for k, v in kwargs.items() if k in known})
cls.__init__ = __init__
for _name, _cls in _inspect.getmembers(_bambu_models, _inspect.isclass):
if _dc.is_dataclass(_cls):
_make_permissive(_cls)
#Record the time the bot started
start_time = time.time()
start_time = time.time()
config = configparser.RawConfigParser()
configFilePath = r'bot_config.conf'
# Last error message variable used by $last_error command to display in discord
global last_error
last_error = "No errors been recorded."
try:
config.read(configFilePath)
except:
print("Error loading config! Please check config file 'bot-config.conf'")
# Setup HomeAssistant URL and Headers
# Last error message variable used by $last_error command to display in discord
last_error_msg = "No errors have been recorded."
#
# Assign bot config from setting in config file
#
# Assign Bot core settings
DISCORD_AUTH_TOKEN = config.get('bot-config', 'discord_auth_token')
BOT_COMMAND_PREFIX = config.get('bot-config', 'bot_command_prefix')
# 3D Printer Setup - HomeAssistant URL and Headers & OctoPrint
HASS_TOKEN = config.get('bot-config', 'hass_token')
HASS_URL = config.get('bot-config', 'hass_url')
HASS_LIGHT = config.get('bot-config', 'hass_light')
@@ -43,28 +66,164 @@ hassHEADERS = {
'Authorization': f"Bearer {HASS_TOKEN}",
'content-type': 'application/json',
}
OCTOPRINT_IP_ADDRESS = config.get('bot-config', 'octoprint_ip_address')
DISCORD_AUTH_TOKEN = config.get('bot-config', 'discord_auth_token')
# Bambu Lab Printer config (optional — feature is skipped if not set)
BAMBU_IP_ADDRESS = config.get('bot-config', 'bambu_ip_address', fallback=None)
BAMBU_ACCESS_CODE = config.get('bot-config', 'bambu_access_code', fallback=None)
BAMBU_SERIAL_NUMBER = config.get('bot-config', 'bambu_serial_number', fallback=None)
BAMBU_CAMERA_ENABLE = config.get('bot-config', 'bambu_camera_enable', fallback='false').lower() == 'true'
# Module-level cache for Bambu printer status, updated by the MQTT watch callback
bambu_status = None
bambu_client = None
_bot_loop = None # set in on_ready; used by the MQTT thread
_last_bambu_activity_update = 0.0
_bambu_was_printing = False
def _on_bambu_update(status):
"""Callback invoked by bambu-connect's MQTT thread with the latest PrinterStatus."""
global bambu_status, _last_bambu_activity_update, _bambu_was_printing
bambu_status = status
if _bot_loop is None:
return
now = time.time()
if status.gcode_state == "RUNNING":
_bambu_was_printing = True
# Throttle Discord presence updates to once every 30 seconds
if (now - _last_bambu_activity_update) >= 30:
_last_bambu_activity_update = now
asyncio.run_coroutine_threadsafe(_update_bambu_activity(status), _bot_loop)
elif _bambu_was_printing:
# State just left RUNNING (paused, finished, failed) — reset presence
_bambu_was_printing = False
asyncio.run_coroutine_threadsafe(_reset_bot_activity(), _bot_loop)
# Configure bot
intents = discord.Intents.default()
intents.message_content = True
intents.members = True
intents.voice_states = True
bot = commands.Bot(command_prefix=BOT_COMMAND_PREFIX, description='A derpy derp of a bot.', intents=intents)
bot.remove_command('help')
# Load opus once at startup rather than on every sound command
discord.opus.load_opus("libopus.so")
# Printing configuration details to console
print(f"HomeAssistant URL: {hassURL}")
print(f"HomeAssistant URL HEADERS: {hassHEADERS}")
print(f"HomeAssistant Light: {HASS_LIGHT}")
print(f"OctoPrint IP Address: {OCTOPRINT_IP_ADDRESS}")
print("=== 3D Printer Status config ===")
print(f" HomeAssistant URL: {hassURL}")
print(f" HomeAssistant URL HEADERS: {hassHEADERS}")
print(f" HomeAssistant Light: {HASS_LIGHT}")
print(f" OctoPrint IP Address: {OCTOPRINT_IP_ADDRESS}")
async def _update_bambu_activity(status):
remaining_mins = status.mc_remaining_time or 0
remaining_hours = remaining_mins // 60
remaining_mins_part = remaining_mins % 60
activity = discord.Activity(
name=f"Bambu @ {status.mc_percent}%, {remaining_hours}h{remaining_mins_part:02d}m to go",
type=discord.ActivityType.watching,
)
await bot.change_presence(activity=activity)
async def _capture_bambu_frame(filename):
"""Capture a single JPEG frame from the Bambu RTSPS stream via ffmpeg.
Returns True on success, raises on timeout or ffmpeg error."""
rtsp_url = f"rtsps://bblp:{BAMBU_ACCESS_CODE}@{BAMBU_IP_ADDRESS}/streaming/live/1"
proc = await asyncio.create_subprocess_exec(
"ffmpeg", "-y",
"-rtsp_transport", "tcp",
"-i", rtsp_url,
"-vframes", "1",
"-q:v", "2",
filename,
stdout=asyncio.subprocess.DEVNULL,
stderr=asyncio.subprocess.PIPE,
)
_, stderr = await asyncio.wait_for(proc.communicate(), timeout=15)
if proc.returncode != 0:
print(f" ! ffmpeg stderr: {stderr.decode(errors='replace').strip()}")
return proc.returncode == 0
async def _reset_bot_activity():
activity = discord.Activity(
name=f"your {BOT_COMMAND_PREFIX}commands",
type=discord.ActivityType.listening,
)
await bot.change_presence(activity=activity)
# Background task: poll OctoPrint every 2 minutes and update bot status if printing
@tasks.loop(seconds=120)
async def check_printer_status():
try:
print(">> Checking 3D Printer Status")
# Run the synchronous octoapi call in a thread so it doesn't block
# the event loop and starve Discord's heartbeat on slow/unreachable hosts
loop = asyncio.get_running_loop()
print_completion = round(await loop.run_in_executor(None, octoapi.get_completion), 2)
except Exception:
print_completion = "Unknown"
print(">>>> Nothing Printing.")
if print_completion != "Unknown" and print_completion < 100:
print(">>>> Something is printing, calling UpdateStatus")
await updateStatus()
else:
# Will hit this if the last print job completed and is sitting at 100%
print(">>>> Nothing Printing.")
# On Ready
@bot.event
async def on_ready():
print("\n:::: Config Loaded ::::\n")
print('Logged in as')
print(bot.user.name)
print(bot.user.id)
print('------')
print("Setting activity to 'Listenting to your commands")
activity = discord.Activity(name="your commands",type=discord.ActivityType.listening)
print(f" User: {bot.user.name}")
print(f" ID: {bot.user.id}")
print(f"\n\n")
print(f"Setting activity to 'Listenting to your {BOT_COMMAND_PREFIX}commands'")
activity = discord.Activity(name=f"your {BOT_COMMAND_PREFIX}commands",type=discord.ActivityType.listening)
await bot.change_presence(activity=activity)
print(">> Startup complete.")
# Clear any stale voice states left over from a previous session.
# Discord holds onto the bot's voice state across restarts; if not cleared,
# the first voice connect attempt gets a 4006 (session no longer valid).
print(">> Clearing stale voice states across all guilds")
for guild in bot.guilds:
try:
await guild.change_voice_state(channel=None)
except Exception as e:
print(f" ! Could not clear voice state for {guild.name}: {e}")
# Start the printer polling task (guard against double-start on reconnects)
if not check_printer_status.is_running():
check_printer_status.start()
# Store the running event loop so the Bambu MQTT thread can schedule coroutines
global _bot_loop
_bot_loop = asyncio.get_running_loop()
# Start the Bambu watch client if config is present
global bambu_client
if BAMBU_IP_ADDRESS and BAMBU_ACCESS_CODE and BAMBU_SERIAL_NUMBER:
if bambu_client is None:
print(">> Connecting to Bambu printer MQTT watch client")
bambu_client = BambuClient(BAMBU_IP_ADDRESS, BAMBU_ACCESS_CODE, BAMBU_SERIAL_NUMBER)
bambu_client.start_watch_client(_on_bambu_update)
print(">> Bambu watch client started")
else:
print(">> Bambu printer config not found, skipping Bambu watch client")
@bot.command()
async def greetings(ctx):
await ctx.send(":smiley: :wave: Hello there!")
@@ -72,41 +231,26 @@ async def greetings(ctx):
@bot.event
async def on_command_error(ctx, error):
global last_error_msg
last_error_msg = error
if isinstance(error, commands.CommandOnCooldown):
seconds = round(error.retry_after,1)
print(f" - Error, user tried to use command while in cooldown (wait is: {seconds}")
print(f" - Error, user tried to use command while in cooldown (wait is: {seconds})")
await ctx.send(f"This command is ratelimited per user, please try again in {seconds}s")
if isinstance(error, commands.CommandInvokeError):
elif isinstance(error, commands.CommandInvokeError):
print(" - ERROR: encountered 'CommandInvokeError'")
print(f" - Dumping error: {error}")
last_error = error
await ctx.send("Error, unable to complete your request.")
else:
print('Oopsie, I found an error...')
print(f"Error: {error}")
last_error = error
#
# Debug commands
#
@bot.command()
async def last_error(ctx):
await ctx.send(f"Last error recorded: {last_error}")
@bot.command()
async def uptime(ctx):
# Displays how long the bot has been online
second = time.time() - start_time
minute, second = divmod(second, 60)
hour, minute = divmod(minute, 60)
day, hour = divmod(hour, 24)
week, day = divmod(day, 7)
week = int(week)
day = int(day)
hour = int(hour)
minute = int(minute)
second = int(second)
await ctx.send(f"Uptime [WW:DD:HH:MM:SS]: {week:02d}:{day:02d}:{hour:02d}:{minute:02d}:{second:02d}")
await ctx.send(f"Last error recorded: {last_error_msg}")
#
# Giphy Commands
@@ -137,14 +281,13 @@ async def smudge(ctx):
#
# Voice Commands
#
@bot.command()
@commands.cooldown(rate=1, per=30.0, type=commands.BucketType.user)
async def bitch(ctx, member : discord.Member="NONE"):
datestring = datetime.now()
datestring = datestring.strftime("%m/%d/%Y-%H:%M:%S")
if ctx.message.channel.is_nsfw():
await play_sound(ctx, member, "./sounds/monkey_bitch.mp3", "$bitch", 5)
await play_sound(ctx, member, "./sounds/monkey_bitch.mp3", "$bitch")
else:
print(f"[{datestring}]: {ctx.message.author.display_name} called $bitch, but is not in a NSFW channel")
await ctx.send("This command is too explicit for you!")
@@ -152,7 +295,7 @@ async def bitch(ctx, member : discord.Member="NONE"):
@bot.command()
@commands.cooldown(rate=1, per=10.0, type=commands.BucketType.user)
async def cowbell(ctx, member : discord.Member="NONE"):
await play_sound(ctx, member, "./sounds/More_cowbell.mp3", "$cowbell", 5)
await play_sound(ctx, member, "./sounds/More_cowbell.mp3", "$cowbell")
@bot.command()
@commands.cooldown(rate=1, per=10.0, type=commands.BucketType.user)
@@ -160,7 +303,7 @@ async def boom(ctx, member : discord.Member="NONE"):
datestring = datetime.now()
datestring = datestring.strftime("%m/%d/%Y-%H:%M:%S")
if ctx.message.channel.is_nsfw():
await play_sound(ctx, member, "./sounds/BoomBitch.mp3", "$boom", 5)
await play_sound(ctx, member, "./sounds/BoomBitch.mp3", "$boom")
else:
print(f"[{datestring}]: {ctx.message.author.display_name} called $boom, but is not in a NSFW channel")
await ctx.send("This command is too explicit for you!")
@@ -168,37 +311,71 @@ async def boom(ctx, member : discord.Member="NONE"):
@bot.command()
@commands.cooldown(rate=1, per=10.0, type=commands.BucketType.user)
async def oops(ctx, member : discord.Member="NONE"):
await play_sound(ctx, member, "./sounds/Oops.mp3", "$oops", 5)
await play_sound(ctx, member, "./sounds/Oops.mp3", "$oops")
@bot.command()
@commands.cooldown(rate=1, per=10.0, type=commands.BucketType.user)
async def trololo(ctx, member : discord.Member="NONE"):
await play_sound(ctx, member, "./sounds/Trololo.mp3", "$trololo", 5)
await play_sound(ctx, member, "./sounds/Trololo.mp3", "$trololo")
@bot.command()
@commands.cooldown(rate=1, per=10.0, type=commands.BucketType.user)
async def leeroy(ctx, member : discord.Member="NONE"):
await play_sound(ctx, member, "./sounds/leeroy.mp3", "$leeroy", 5)
await play_sound(ctx, member, "./sounds/leeroy.mp3", "$leeroy")
@bot.command()
@commands.cooldown(rate=1, per=10.0, type=commands.BucketType.user)
async def promoted(ctx, member : discord.Member="NONE"):
await play_sound(ctx, member, "./sounds/Promoted.mp3", "$promoted", 5)
await play_sound(ctx, member, "./sounds/Promoted.mp3", "$promoted")
@bot.command()
@commands.cooldown(rate=1, per=10.0, type=commands.BucketType.user)
async def wow(ctx, member : discord.Member="NONE"):
await play_sound(ctx, member, "./sounds/wow.mp3", "$wow", 5)
await play_sound(ctx, member, "./sounds/wow.mp3", "$wow")
@bot.command()
@commands.cooldown(rate=1, per=10.0, type=commands.BucketType.user)
async def aww(ctx, member : discord.Member="NONE"):
await play_sound(ctx, member, "./sounds/Awww_Bitch.mp3", "$aww", 5)
await play_sound(ctx, member, "./sounds/Awww_Bitch.mp3", "$aww")
@bot.command()
@commands.cooldown(rate=1, per=10.0, type=commands.BucketType.user)
async def eia(ctx, member : discord.Member="NONE"):
await play_sound(ctx, member, "./sounds/awesome.mp3", "$eia", 11)
await play_sound(ctx, member, "./sounds/awesome.mp3", "$eia")
@bot.command()
@commands.cooldown(rate=1, per=10.0, type=commands.BucketType.user)
async def yaw(ctx, member : discord.Member="NONE"):
await play_sound(ctx, member, "./sounds/yaw.mp3", "$yaw")
@bot.command()
@commands.cooldown(rate=1, per=10.0, type=commands.BucketType.user)
async def heavy(ctx, member : discord.Member="NONE"):
await play_sound(ctx, member, "./sounds/heavy.mp3", "$heavy")
@bot.command()
@commands.cooldown(rate=1, per=10.0, type=commands.BucketType.user)
async def iran(ctx, member : discord.Member="NONE"):
await play_sound(ctx, member, "./sounds/iran.mp3", "$iran")
@bot.command()
@commands.cooldown(rate=1, per=10.0, type=commands.BucketType.user)
async def big(ctx, member : discord.Member="NONE"):
await play_sound(ctx, member, "./sounds/big.mp3", "$big")
@bot.command()
@commands.cooldown(rate=1, per=10.0, type=commands.BucketType.user)
async def breee(ctx, member : discord.Member="NONE"):
await ctx.send(f"\m/ ( ゚Д゚)<BREEEEE!! \m/")
await play_sound(ctx, member, "./sounds/wbbwb_metal.mp3", "$breee")
@bot.command()
@commands.cooldown(rate=1, per=10.0, type=commands.BucketType.user)
async def nice(ctx, member : discord.Member="NONE"):
await ctx.send(f"\m/ ( ゚Д゚)<N!CE! \m/")
await play_sound(ctx, member, "./sounds/wbtbwb-nice.mp3", "$nice")
@bot.command()
@commands.cooldown(rate=1, per=10.0, type=commands.BucketType.user)
@@ -212,9 +389,7 @@ async def rs(ctx, member : discord.Member="NONE"):
print(f"[{datestring}]: {ctx.message.author.display_name} called $rs, but is not in a NSFW channel")
await ctx.send("This command is too explicit for you!")
async def play_sound(ctx, member : discord.Member, soundFile, command, playtime):
discord.opus.load_opus("libopus.so")
async def play_sound(ctx, member : discord.Member, soundFile, command):
datestring = datetime.now()
datestring = datestring.strftime("%m/%d/%Y-%H:%M:%S")
@@ -226,7 +401,7 @@ async def play_sound(ctx, member : discord.Member, soundFile, command, playtime)
if member != "NONE":
try:
channel = member.voice.channel
except:
except AttributeError:
await ctx.send(f"{member.display_name} is not in a voice channel!")
print(f" ! {member.display_name} is not in a voice channel")
return
@@ -236,7 +411,7 @@ async def play_sound(ctx, member : discord.Member, soundFile, command, playtime)
if member == "NONE":
try:
channel = ctx.message.author.voice.channel
except:
except AttributeError:
await ctx.send("You are not connected to a voice channel.")
print("User is not connected to a voice channel")
return
@@ -254,14 +429,17 @@ async def play_sound(ctx, member : discord.Member, soundFile, command, playtime)
else:
print(f" - Joining Channel '{channel}''")
await ctx.send(f"Joining '{channel}' for just a moment")
voice = await channel.connect()
# reconnect=False disables discord.py's internal retry loop so it doesn't
# hammer the same invalid session repeatedly (which was causing "attempt 4").
voice = await channel.connect(reconnect=False)
print(" - Creating Player")
audio_source = discord.FFmpegPCMAudio(soundFile)
print(f" - Playing {soundFile}")
time.sleep(1)
await asyncio.sleep(1)
voice.play(audio_source, after=None)
time.sleep(playtime)
while voice.is_playing():
await asyncio.sleep(1)
print(f" - Disconnecting from '{channel}'")
await voice.disconnect()
###
@@ -277,25 +455,22 @@ async def printstat(ctx):
print(f"[{datestring}]: {ctx.message.author.display_name} called $printstat")
#print("========== Command Called at %s ==========" % (time.strftime("%Y%m%d-%H%M%S")))
# We haven't yet changed the state of the light, setting this to False
turned_on_light = False
# No Data from Printer?
operational = True
# Try to get the status of the 3D printer light
print(" - Getting Printer Light Status")
work_lights = requests.get(hassURL, headers=hassHEADERS)
print(f" JSON Response from HomeAssistant: {work_lights.text}")
loop = asyncio.get_running_loop()
work_lights_resp = await loop.run_in_executor(None, lambda: requests.get(hassURL, headers=hassHEADERS))
print(f" JSON Response from HomeAssistant: {work_lights_resp.text}")
work_lights = json.loads(work_lights.text)
work_lights = json.loads(work_lights_resp.text)
# Making sure that the API request succeeded. If it has, there will be a state attribute added to
# work_lights.
# work_lights.
try:
work_lights["state"]
except:
except KeyError:
print(" ! Unable to get light status from Homeassistant, notifying chat channel")
await ctx.send("Hmm, I can't tell if the light is on... oh well [Hass API error]")
@@ -317,19 +492,17 @@ async def printstat(ctx):
await ctx.send(f"{random.choice(lightMessages)}")
try:
# REST API call to home assistant to turn the light off.
# REST API call to home assistant to turn the light on.
hassAPIURL = HASS_URL + "/api/services/switch/turn_on"
payload = f'{{"entity_id": "{HASS_LIGHT}"}}'
#print(f" - Payload String: {payload}")
response = requests.post(hassAPIURL, headers=hassHEADERS, data=payload)
#print(f" - POST Response: {response.text}")
await loop.run_in_executor(None, lambda: requests.post(hassAPIURL, headers=hassHEADERS, data=payload))
except Exception as e:
print(f" ! Unable to turn on light; ERROR: {e}")
await ctx.send("Sorry, I was unable to turn on the light.")
pass
time.sleep(3)
await asyncio.sleep(3)
# Randomly generate a filename to save the image to
file_name = random.randrange(1,10000)
@@ -337,7 +510,8 @@ async def printstat(ctx):
# Get an image from OctoPrint and save it
print(" - Getting image from Webcam")
urllib.request.urlretrieve("http://%s:8080/?action=snapshot" % (OCTOPRINT_IP_ADDRESS), full_file_name)
await loop.run_in_executor(None, lambda: urllib.request.urlretrieve(
"http://%s:8080/?action=snapshot" % (OCTOPRINT_IP_ADDRESS), full_file_name))
# If we turned on the light, let's be nice and turn it back off
if turned_on_light:
@@ -346,8 +520,7 @@ async def printstat(ctx):
# REST API call to home assistant to turn the light off.
hassAPIURL = HASS_URL + "/api/services/switch/turn_off"
payload = f'{{"entity_id": "{HASS_LIGHT}"}}'
response = requests.post(hassAPIURL, headers=hassHEADERS, data=payload)
#print(f" - POST Response: {response.text}")
await loop.run_in_executor(None, lambda: requests.post(hassAPIURL, headers=hassHEADERS, data=payload))
except Exception as e:
print(f" ! Unable to turn on light; ERROR: {e}")
@@ -366,75 +539,78 @@ async def printstat(ctx):
print(" - Connecting to OctoPrint API")
# Testing OctoPrint API Status. If printer is off, I won't receive JSON data.
try:
operational = json.loads(octoapi.get_printer_dict())
except:
operational = await loop.run_in_executor(None, octoapi.get_printer_dict)
except Exception:
# Printer is Offline
operational = False
if not operational:
if operational:
print(" - 3D Printer is on and printing, getting details")
# Get the name of the file currently being printed
try:
print(" - Getting Filename")
print_filename = octoapi.get_printFileName()
except:
print_filename = await loop.run_in_executor(None, octoapi.get_printFileName)
except Exception:
print_filename = ""
try:
print(" - Getting % Completion")
# Try to get the % of Completion
print_completion = round(octoapi.get_completion(), 2)
except:
print_completion = round(await loop.run_in_executor(None, octoapi.get_completion), 2)
except Exception:
print_completion = "Unknown"
# Get the current print time in seconds
try:
print(" - Getting Seconds Elapsed")
print_seconds = octoapi.get_printTime()
except:
print_seconds = await loop.run_in_executor(None, octoapi.get_printTime)
except Exception:
print("Unable to get Seconds data from OctoPrint")
print_seconds = 0
# Get the time remaining for current print job in seconds
try:
print(" - Getting Seconds Left")
print_secondsleft = octoapi.get_printTimeLeft()
except:
print_secondsleft = await loop.run_in_executor(None, octoapi.get_printTimeLeft)
except Exception:
print(" ! Unable to get Seconds Left from OctoPrint")
print_secondsleft = 0
try:
print(" - Converting Seconds to Hours")
# Try to convert seconds to hours
print_hours = int(((print_seconds / 60) / 60))
except:
except (TypeError, ValueError):
print_hours = "Unknown"
try:
print(" - Converting Seconds left to Hours left")
# Try to convert seconds left to hours left
print_hoursleft = int(((print_secondsleft / 60) / 60))
except:
except (TypeError, ValueError):
print_hoursleft = "Unknown"
try:
print(" - Calculating Minutes Elapsed")
# Using the total number of minutes minus the total number of whole hours to get the minutes remaining
print_min = int(((print_seconds / 60) - (print_hours * 60)))
except:
except (TypeError, ValueError):
print_min = "Unknown"
try:
print(" - Calculating Minutes Left")
# Same as above but for the minutes left in print job
print_minleft = int(((print_secondsleft / 60) - (print_hoursleft * 60)))
except:
except (TypeError, ValueError):
print_minleft = "Unknown"
time_elapsed = "%s Hours %s Minutes" % (print_hours, print_min)
time_remaining = "%s Hours %s Minutes" % (print_hoursleft, print_minleft)
printer_bed = "%s°C" % (octoapi.get_printer_dict()["temperature"]["bed"]["actual"])
printer_hotend = "%s°C" % (octoapi.get_printer_dict()["temperature"]["tool0"]["actual"])
# operational dict already fetched above — use it directly instead of calling again
printer_bed = "%s°C" % (operational["temperature"]["bed"]["actual"])
printer_hotend = "%s°C" % (operational["temperature"]["tool0"]["actual"])
embed = discord.Embed(title="R0b3's 3D Printer Status", description="Current Job: " + print_filename, color=0xF5A623)
@@ -443,11 +619,14 @@ async def printstat(ctx):
embed.add_field(name="Time Remaining: ", value=time_remaining)
embed.add_field(name="Bed Temp.: ", value=printer_bed)
embed.add_field(name="Hotend Temp.: ", value=printer_hotend)
embed.add_field(name="Livestream URL: ",value="https://rickelobe.com/printer/?action=stream")
print(" - Sending details to chat channel")
await ctx.send(embed=embed)
activity = discord.Activity(name=f"3D Print @ {str(print_completion)}%",type=discord.ActivityType.watching)
await bot.change_presence(activity=activity)
await updateStatus()
## No longer need to update the bot status here since there's a check happening every 2 mins in on_ready
#activity = discord.Activity(name=f"3D Print @ {str(print_completion)}%",type=discord.ActivityType.watching)
#await bot.change_presence(activity=activity)
#await updateStatus() # No longer need to call this since it the bot now checks for a print job every 2 mins.
else:
print(" - 3D Printer is not on or is not printing")
@@ -458,27 +637,55 @@ async def printstat(ctx):
async def updateStatus():
# Initialize variables
# Unknowns is present to handle issues like print paused or cancelled
print_completion = 0
unknowns = 0
loop = asyncio.get_running_loop()
#While the print status is less than 100 % complete, keep updating
while print_completion < 100:
try:
print(" - Getting % Completion")
# Try to get the % of Completion
print_completion = round(octoapi.get_completion(), 2)
except:
print_completion = round(await loop.run_in_executor(None, octoapi.get_completion), 1)
except Exception:
print_completion = 999
unknowns += 1
try:
print_secondsleft = await loop.run_in_executor(None, octoapi.get_printTimeLeft)
except Exception:
print(" ! Unable to get Seconds Left from OctoPrint")
print_secondsleft = 0
try:
# Try to convert seconds left to hours left
print_hoursleft = int(((print_secondsleft / 60) / 60))
except (TypeError, ValueError):
print_hoursleft = "Unknown"
try:
# Same as above but for the minutes left in print job
print_minleft = int(((print_secondsleft / 60) - (print_hoursleft * 60)))
except (TypeError, ValueError):
print_minleft = "Unknown"
if print_minleft == "Unknown" or print_hoursleft == "Unknown":
time_left = "Unknown"
else:
time_left = f"{print_hoursleft:02d}:{print_minleft:02d}"
#Set the activity to the new percent complete value
if print_completion != 999:
activity = discord.Activity(name=f"3D Print @ {str(print_completion)}%",type=discord.ActivityType.watching)
unknowns = 0
print(f" - Print job is at {print_completion}%, with {time_left} to go")
activity = discord.Activity(name=f"3D Print @ {str(print_completion)}%, {time_left} to go",type=discord.ActivityType.watching)
else:
unknowns += 1
print(f" - Error getting print status ({unknowns}/5 Errors)")
activity = discord.Activity(name=f"3D Print @ ERROR",type=discord.ActivityType.watching)
await bot.change_presence(activity=activity)
if (unknowns >= 5):
print(" - Reached 5 consecutive errors, breaking from loop")
break
await asyncio.sleep(30)
@@ -494,9 +701,80 @@ async def updateStatus():
print(" - Done watching 3D Printer status")
await asyncio.sleep(3)
activity = discord.Activity(name="your commands",type=discord.ActivityType.listening)
activity = discord.Activity(name=f"your {BOT_COMMAND_PREFIX}commands",type=discord.ActivityType.listening)
await bot.change_presence(activity=activity)
#
# Bambu Lab Printer Commands
#
@bot.command()
async def bambustat(ctx):
datestring = datetime.now().strftime("%m/%d/%Y-%H:%M:%S")
print(f"[{datestring}]: {ctx.message.author.display_name} called $bambustat")
if bambu_status is None:
await ctx.send("Bambu printer status is not available yet. The printer may be offline or still connecting.")
return
status = bambu_status
gcode_state = status.gcode_state or "Unknown"
gcode_file = status.gcode_file or "Unknown"
mc_percent = status.mc_percent if status.mc_percent is not None else "Unknown"
# mc_remaining_time is in minutes
remaining_mins = status.mc_remaining_time or 0
remaining_hours = remaining_mins // 60
remaining_mins_part = remaining_mins % 60
time_remaining = f"{remaining_hours}h {remaining_mins_part:02d}m"
nozzle_temp = f"{status.nozzle_temper:.1f}°C" if status.nozzle_temper is not None else "Unknown"
bed_temp = f"{status.bed_temper:.1f}°C" if status.bed_temper is not None else "Unknown"
chamber_temp = f"{status.chamber_temper:.1f}°C" if status.chamber_temper is not None else "Unknown"
layer_info = "Unknown"
if status.layer_num is not None and status.total_layer_num is not None:
layer_info = f"{status.layer_num} / {status.total_layer_num}"
embed = discord.Embed(
title="Bambu Lab Printer Status",
description=f"File: {gcode_file}",
color=0x00B4D8,
)
embed.add_field(name="State:", value=gcode_state, inline=False)
embed.add_field(name="Percent Complete:", value=f"{mc_percent}%")
embed.add_field(name="Time Remaining:", value=time_remaining)
embed.add_field(name="Layer:", value=layer_info)
embed.add_field(name="Nozzle Temp:", value=nozzle_temp)
embed.add_field(name="Bed Temp:", value=bed_temp)
embed.add_field(name="Chamber Temp:", value=chamber_temp)
# Try to grab a snapshot via ffmpeg RTSPS (only if enabled in config)
image_filename = None
if BAMBU_CAMERA_ENABLE and BAMBU_IP_ADDRESS and BAMBU_ACCESS_CODE:
image_filename = f"bambu_{random.randrange(1, 10000)}.jpg"
try:
print(" - Capturing Bambu camera frame via RTSPS")
success = await _capture_bambu_frame(image_filename)
if not success:
print(" ! ffmpeg exited with non-zero code, skipping image")
image_filename = None
except asyncio.TimeoutError:
print(" ! ffmpeg timed out capturing Bambu camera frame")
image_filename = None
except Exception as e:
print(f" ! Unable to capture Bambu camera frame: {e}")
image_filename = None
print(" - Sending Bambu details to chat channel")
if image_filename:
file = discord.File(image_filename, filename=image_filename)
await ctx.send(file=file, embed=embed)
os.remove(image_filename)
else:
await ctx.send(embed=embed)
@bot.command()
async def info(ctx):
@@ -511,34 +789,96 @@ async def info(ctx):
# give users a link to invite thsi bot to their server
embed.add_field(name="Invite", value="[Invite link](https://discordapp.com/api/oauth2/authorize?client_id=416312716677087233&permissions=51264&scope=bot)")
# Bot Uptime
second = time.time() - start_time
minute, second = divmod(second, 60)
hour, minute = divmod(minute, 60)
day, hour = divmod(hour, 24)
week, day = divmod(day, 7)
week = int(week)
day = int(day)
hour = int(hour)
minute = int(minute)
second = int(second)
embed.add_field(name="Uptime [WW:DD:HH:MM:SS]:", value=f"{week:02d}:{day:02d}:{hour:02d}:{minute:02d}:{second:02d}", inline=False)
print("Getting git describe data to display as version in info embed")
bot_version = await run('git describe --tags')
embed.add_field(name="Version:", value=f"{bot_version}", inline=False)
embed.add_field(name="discord.py Version:", value=f"{discord.__version__}", inline=False)
# Gitlab link to source
embed.add_field(name="Source Code:", value="[R0b3Bot on Gitlab](https://gitlab.rickelobe.com/Bots/r0b3BOT)", inline=False)
await ctx.send(embed=embed)
bot.remove_command('help')
#
#
#
#@bot.command()
#async def commands(ctx):
# # Redirect to the 'help' command
# await help(ctx)
@bot.command()
async def help(ctx):
embed = discord.Embed(title="R0b3BOT", description="List of commands are:", color=0xeee657)
embed.add_field(name="$printstat", value="Uploads a snapshot of Rich's 3D printer and current stats", inline=False)
embed.add_field(name="$explain", value="Displays Dalek EXPLAIN gif", inline=False)
embed.add_field(name="$holyshit", value="Displays Marty McFly HOLY SHIT gif", inline=False)
embed.add_field(name="$greetings", value="Gives a nice greet message", inline=False)
embed.add_field(name="$cat", value="Gives a cute cat gif to lighten up the mood.", inline=False)
embed.add_field(name="$bitch @member", value="Plays clip of BigEric420 saying 'maybe you shouldn't be such a bitch.mp3'", inline=False)
embed.add_field(name="$boom @member", value="Plays 'Boom Bitch' sound clip", inline=False)
embed.add_field(name="$cowbell @member", value="Plays 'SNL More Cowbell' sound clip", inline=False)
embed.add_field(name="$oops @member", value="Plays 'Oops.mp3'", inline=False)
embed.add_field(name="$promoted @member", value="Plays Battlefield Friends 'PROMOTED!' sound clip", inline=False)
embed.add_field(name="$trololo @member", value="Plays a clip of Trololo song", inline=False)
embed.add_field(name="$leeroy @member", value="Plays Leeeerrroooyyy Jenkins clip", inline=False)
embed.add_field(name="$eia @member", value="Plays 'Everything is Awesome' song clip")
embed.add_field(name="$info", value="Gives a little info about the bot", inline=False)
embed.add_field(name="$help", value="Gives this message", inline=False)
embed.add_field(name="$last_error", value="Will display the real error message the bot has last encountered for additional debugging info")
embed.add_field(name="$uptime", value="Displays how long the bot has been up since last service restart")
embed = discord.Embed(title='Core & Debug Commands:', description="Core commands for info and debug", color=0xeee657)
embed.add_field(name=f"{BOT_COMMAND_PREFIX}info", value="Gives a little info about the bot", inline=False)
embed.add_field(name=f"{BOT_COMMAND_PREFIX}help", value="Gives this message", inline=False)
embed.add_field(name=f"{BOT_COMMAND_PREFIX}last_error", value="Will display the real error message the bot has last encountered for additional debugging info")
embed.add_field(name=f"{BOT_COMMAND_PREFIX}greetings", value="Gives a nice greeting message", inline=False)
await ctx.send(embed=embed)
embed = discord.Embed(title="A note about sound clips:", description="Sound clips are only played voice channels. If no user is specified when calling the command, the sound will played in the channel the user is currently joined to. When a username is specified, the bot will play the sound in the channel that user is currently in.")
embed = discord.Embed(title="GIF Commands", description="Commands to call up a GIF image", color=0xeee657)
embed.add_field(name=f"{BOT_COMMAND_PREFIX}explain", value="Displays Dalek EXPLAIN gif", inline=False)
embed.add_field(name=f"{BOT_COMMAND_PREFIX}holyshit", value="Displays Marty McFly HOLY SHIT gif", inline=False)
embed.add_field(name=f"{BOT_COMMAND_PREFIX}cat", value="Gives a cute cat gif to lighten up the mood.", inline=False)
await ctx.send(embed=embed)
embed = discord.Embed(title="Sound Commands", description="To play a sound in a chat channel, use one of the following:", color=0xeee657)
embed.add_field(name=f"{BOT_COMMAND_PREFIX}aww @member", value="Plays Rick & Morty clip 'Awww bitch'", inline=False)
embed.add_field(name=f"{BOT_COMMAND_PREFIX}bitch @member", value="Plays clip of BigEric420 saying 'maybe you shouldn't be such a bitch.mp3'", inline=False)
embed.add_field(name=f"{BOT_COMMAND_PREFIX}big @member", value="Plays 'Wiz Khalifa clip'", inline=False)
embed.add_field(name=f"{BOT_COMMAND_PREFIX}boom @member", value="Plays 'Boom Bitch' sound clip", inline=False)
embed.add_field(name=f"{BOT_COMMAND_PREFIX}breee @member", value="Plays 'BREEEEE' clip from a WBTBWB song", inline=False)
embed.add_field(name=f"{BOT_COMMAND_PREFIX}cowbell @member", value="Plays 'SNL More Cowbell' sound clip", inline=False)
embed.add_field(name=f"{BOT_COMMAND_PREFIX}eia @member", value="Plays 'Everything is Awesome' song clip", inline=False)
embed.add_field(name=f"{BOT_COMMAND_PREFIX}heavy @member", value="Plays 'Poppy ooo heavy'", inline=False)
embed.add_field(name=f"{BOT_COMMAND_PREFIX}iran @member", value="Plays Trump 'I Ran'", inline=False)
embed.add_field(name=f"{BOT_COMMAND_PREFIX}leeroy @member", value="Plays Leeeerrroooyyy Jenkins clip", inline=False)
embed.add_field(name=f"{BOT_COMMAND_PREFIX}nice @member", value="Plays clip from WBTBWB - Nice!", inline=False)
embed.add_field(name=f"{BOT_COMMAND_PREFIX}oops @member", value="Plays 'Oops.mp3'", inline=False)
embed.add_field(name=f"{BOT_COMMAND_PREFIX}promoted @member", value="Plays Battlefield Friends 'PROMOTED!' sound clip", inline=False)
embed.add_field(name=f"{BOT_COMMAND_PREFIX}trololo @member", value="Plays a clip of Trololo song", inline=False)
embed.add_field(name=f"{BOT_COMMAND_PREFIX}wow @member", value="Plays clip of Owen Wilson saying 'Woooow'", inline=False)
embed.add_field(name=f"{BOT_COMMAND_PREFIX}yaw @member", value="Plays clip of Busta Ryhmes 'Yaw Yaw Yaw'", inline=False)
await ctx.send(embed=embed)
embed = discord.Embed(title="A note about sound clips:", description="Sound clips are only played in voice channels. If a user is not specified when calling the command, the sound will played in the channel of that issuing user is currently joined to. When a username is specified, the bot will play the sound in the channel that user is currently in.")
await ctx.send(embed=embed)
embed = discord.Embed(title="3D Printer Status", color=0xeee657)
embed.add_field(name=f"{BOT_COMMAND_PREFIX}printstat", value="Uploads a snapshot of Rich's OctoPrint 3D printer and current stats", inline=False)
await ctx.send(embed=embed)
embed = discord.Embed(title="Bambu Lab Printer Status", color=0x00B4D8)
embed.add_field(name=f"{BOT_COMMAND_PREFIX}bambustat", value="Displays the current status of the Bambu Lab printer (temps, progress, time remaining)", inline=False)
await ctx.send(embed=embed)
# Function to run shell command and return stdout or sterr
async def run(cmd):
proc = await asyncio.create_subprocess_shell(
cmd,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE)
stdout, stderr = await proc.communicate()
print(f'[{cmd!r} exited with {proc.returncode}]')
if stdout:
#print(f'[stdout]\n{stdout.decode()}')
return stdout.decode()
if stderr:
#print(f'[stderr]\n{stderr.decode()}')
return stderr.decode()
bot.run(DISCORD_AUTH_TOKEN)
+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
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.