Skip to content

Commit

Permalink
Added parameter "disable_notification" for sendMessage()
Browse files Browse the repository at this point in the history
  • Loading branch information
gemini1389 committed Nov 8, 2021
1 parent 0dbcac3 commit eae390e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/UniversalTelegramBot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,8 @@ bool UniversalTelegramBot::sendSimpleMessage(const String& chat_id, const String
}

bool UniversalTelegramBot::sendMessage(const String& chat_id, const String& text,
const String& parse_mode, int message_id, bool disable_web_page_preview) {
const String& parse_mode, int message_id, bool disable_web_page_preview,
bool disable_notification) {

DynamicJsonDocument payload(maxMessageLength);
payload["chat_id"] = chat_id;
Expand All @@ -576,6 +577,9 @@ bool UniversalTelegramBot::sendMessage(const String& chat_id, const String& text
if (disable_web_page_preview)
payload["disable_web_page_preview"] = disable_web_page_preview;

if (disable_notification)
payload["disable_notification"] = disable_notification;

return sendPostMessage(payload.as<JsonObject>(), message_id); // if message id == 0 then edit is false, else edit is true
}

Expand Down
2 changes: 1 addition & 1 deletion src/UniversalTelegramBot.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class UniversalTelegramBot {

bool sendSimpleMessage(const String& chat_id, const String& text, const String& parse_mode);
bool sendMessage(const String& chat_id, const String& text, const String& parse_mode = "", int message_id = 0,
bool disable_web_page_preview = false);
bool disable_web_page_preview = false, bool disable_notification = false);
bool deleteMessage(const String& chat_id, int message_id = 0);
bool sendMessageWithReplyKeyboard(const String& chat_id, const String& text,
const String& parse_mode, const String& keyboard,
Expand Down

0 comments on commit eae390e

Please sign in to comment.