raspishake / rsudp

Continuous visual display, sudden motion monitoring, and historical replay of Raspberry Shake data
https://raspishake.github.io/rsudp/
GNU General Public License v3.0
52 stars 30 forks source link

feature request: extra text for Telegram (similar to extra text for twitter module) #28

Closed Larusrafn closed 2 years ago

Larusrafn commented 2 years ago

please add the function to add extra text to the telegram messages, as you can with twitter. thanks.

iannesbitt commented 2 years ago

This feature has been implemented. You can now add the following to your settings file:

"telegram": {
    "enabled": true,
    "send_images": true,
    "token": "n/a",
    "chat_id": "n/a",
    "extra_text": "EXTRA TEXT TEST"},

which should produce a message like this:

(Raspberry Shake station AM.Z0000) Event detected at 2020-01-30 08:27:39.49 UTC EXTRA TEXT TEST - live feed ➡️ https://stationview.raspberryshake.org/#?net=AM&sta=Z0000

The difference between this and the Twitter module is that Telegram is not bound by the 280 character limit. In theory the limitation on what you can type in this field is actually something like 3900 characters, which a function will check for

Note: I have not checked as to whether Telegram will resolve newline characters posted in this field, or whether they will be ignored. They would have to be URL-safe, (i.e. %0A) as I'm sure the module will escape \ns in order to communicate with the api.