From 08c985a805863be0a42985bd04816e60425e0ddc Mon Sep 17 00:00:00 2001 From: Dash Eclipse Date: Tue, 20 Apr 2021 17:20:56 +0000 Subject: [PATCH] utils.telegram: sendMessage with notification disabled --- README.md | 4 ++-- utils/telegram.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3723187..ff6a8fd 100644 --- a/README.md +++ b/README.md @@ -5,14 +5,14 @@ with [AIOHTTP](https://github.com/aio-libs/aiohttp) through [Telegram Bot API](https://core.telegram.org/bots/api#sendmessage) What this project do is very simple, it does not use any Telegram Bot API -framework/library nor receive updates from Telegram, but calling `SendMessage` +framework/library nor receive updates from Telegram, but calling `sendMessage` method of Telegram Bot API directly by sending `GET` requests through AIOHTTP. It should be able to be used along with any existing Telegram bot without conflicts. 1. Receive GitHub webhooks (`POST` request) 2. Verify the SHA256 signature -3. Format and send the text to a Telegram chat through "SendMessage" method of +3. Format and send the text to a Telegram chat through "sendMessage" method of Telegram Bot API (`GET` request) ### Setup diff --git a/utils/telegram.py b/utils/telegram.py index d920018..7691bf4 100644 --- a/utils/telegram.py +++ b/utils/telegram.py @@ -52,7 +52,8 @@ async def send_message(session: ClientSession, chat_id=chat_id, text=text, parse_mode='HTML', - disable_web_page_preview=True + disable_web_page_preview=True, + disable_notification=True ) async with session.post(api_url, data=data) as resp: # type: ClientResponse