utils.telegram: sendMessage with notification disabled

This commit is contained in:
Dash Eclipse
2021-04-20 17:20:56 +00:00
parent 9093ca3253
commit 08c985a805
2 changed files with 4 additions and 3 deletions
+2 -2
View File
@@ -5,14 +5,14 @@ with [AIOHTTP](https://github.com/aio-libs/aiohttp)
through [Telegram Bot API](https://core.telegram.org/bots/api#sendmessage) 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 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. 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 It should be able to be used along with any existing Telegram bot without
conflicts. conflicts.
1. Receive GitHub webhooks (`POST` request) 1. Receive GitHub webhooks (`POST` request)
2. Verify the SHA256 signature 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) Telegram Bot API (`GET` request)
### Setup ### Setup
+2 -1
View File
@@ -52,7 +52,8 @@ async def send_message(session: ClientSession,
chat_id=chat_id, chat_id=chat_id,
text=text, text=text,
parse_mode='HTML', parse_mode='HTML',
disable_web_page_preview=True disable_web_page_preview=True,
disable_notification=True
) )
async with session.post(api_url, async with session.post(api_url,
data=data) as resp: # type: ClientResponse data=data) as resp: # type: ClientResponse