urlwatch
urlwatch copied to clipboard
--telegram-chat can't handle negative sender_chat id values
Adding a bot to a channel (as admin) and mentioning the bot with a /start, this results in a negative sender_chat id value. Urlwatch --telegram-chat can't handle this, resulting in an error message:
urlwatch --telegram-chat --verbose
2021-02-18 12:24:07,135 cli INFO: turning on verbose logging mode
2021-02-18 12:24:07,148 minidb DEBUG: PRAGMA table_info(CacheEntry)
2021-02-18 12:24:07,149 main INFO: Using /root/.urlwatch/urls.yaml as URLs file
2021-02-18 12:24:07,149 main INFO: Using /root/.urlwatch/hooks.py for hooks
2021-02-18 12:24:07,150 main INFO: Using /root/.urlwatch/cache.db as cache database
2021-02-18 12:24:07,157 main INFO: Found 6 jobs
2021-02-18 12:24:07,159 connectionpool DEBUG: Starting new HTTPS connection (1): api.telegram.org:443
2021-02-18 12:24:07,202 connectionpool DEBUG: https://api.telegram.org:443 "GET /bot.../getMe HTTP/1.1" 200 195
2021-02-18 12:24:07,206 connectionpool DEBUG: Starting new HTTPS connection (1): api.telegram.org:443
2021-02-18 12:24:07,246 connectionpool DEBUG: https://api.telegram.org:443 "GET /bot.../getUpdates HTTP/1.1" 200 2392
Traceback (most recent call last):
File "/usr/bin/urlwatch", line 33, in
Confirmed this is an issue in the reporter as well:
% urlwatch --test-reporter telegram
Telegram error: Bad Request: chat not found
This is resolved in the webchanges project and should work here too! Instead of using the negative chat id, just use the @channelusername like this:
telegram:
bot_token: '1234567890:iuasdhoaihofgojsdfoifasofsoiabsfoi'
chat_id:
- '0987654321'
- '@channelusername'
Thanks @mborsetti !
Does this only apply to "channels" (i assume group chats) and not "users"?