[FluidNC PR#1440] NotificationsService: add telegram

未分类 bolang 4个月前 (10-14) 33次浏览

Issue #1440 | 状态: 已关闭 | 作者: filimonic | 创建时间: 2025-01-27


#### Add support for notifications using telegram bot.


$Notification/T1=bot_token
$Notification/T2=chat_id
$Notification/Type=TG
$Notification/Send=Hello, World!
`


#### Memory usage:

| Memory type | Before changes | After changes | Difference |
| ----------- | -------------- | ------------- | ---------- |
| RAM | 69796 | 69796 | 0 |
| Flash | 1845089 | 1845613 | ⚠️+524 |


#### Setup:

##### Obtain bot token:

* Register bot with @BotFather, and get bot token, e.g. 9999999999:ABCdefGHi-JKLmNOpQR-stuvw-xyz012345.

##### Obtain chat id:

* Choose where you want to get notifications: in personal chat or in group chat.
Personal chat*: if you want to get notifications to your personal chat, text
/start to the bot
Group chat*: if you want to get notifications to group chat, invite bot to group, text to group chat
/nameOfYour_bot hello
* Open
https://api.telegram.org/bot{bot-token}/getUpdates in browser and get …”chat”:{“id”:-1234567890 here. The number is chat id. Group chats have negative id, personal chats have positive id.

##### Setup FluidNC with commands:

* $Notification/T1=bot_token, ex, $Notification/T1=9999999999:ABCdefGHi-JKLmNOpQR-stuvw-xyz012345
*
$Notification/T2=chat_id, ex, $Notification/T2=-1234567890
*
$Notification/Type=TG

##### Test notification:

* Test notification with command $Notification/Send=Hello, World!

##### Inject notifications into G-Code:

* For example, add $Notification/Send=Finished` to your End G-Code in LightBurn


评论 (1)

#1 – MitchBradley 于 2025-01-27

Based on the rarity of questions about notifications, I suspect that you could count the number of people who use them on one hand. If they are as rarely used as I suspect, I wonder if it makes sense to add yet another variant that is likely to be used by a single person? Perhaps it would be possible to collapse the entire notifications service into a data-driven class that could send arbitrary messages to arbitrary endpoints?


原始Issue: https://github.com/bdring/FluidNC/pull/1440

喜欢 (0)