Skip to content

Commit 3e1b166

Browse files
committed
Disable notification for most replies
Sometimes annoying to receive 2 nottification sounds when someone in a group sends a command Closes jsmnbom#2
1 parent 87796b9 commit 3e1b166

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

bot/main.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ def start_handler(update: Update, context: CallbackContext):
4242
f'I can notify you about events in your public GitHub repositories. '
4343
f'You can also reply to my messages to post comments to GitHub right from Telegram. '
4444
f'I am an improved version of the Telegram GitHub Bot.\n\n'
45-
f'Use /settings to get started.')
45+
f'Use /settings to get started.',
46+
disable_notification=True)
4647

4748

4849
def help_handler(update: Update, context: CallbackContext):
@@ -64,7 +65,8 @@ def help_handler(update: Update, context: CallbackContext):
6465
url=f'https://telegram.me/{context.bot.username}?startgroup=start')]
6566
]),
6667
parse_mode=ParseMode.HTML,
67-
disable_web_page_preview=True)
68+
disable_web_page_preview=True,
69+
disable_notification=True)
6870

6971

7072
def privacy_handler(update: Update, context: CallbackContext):
@@ -81,7 +83,8 @@ def privacy_handler(update: Update, context: CallbackContext):
8183
f'OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'
8284
f'The MIT-licensed source code for GithubBot revised can be found at <a href="https://github.com/jsmnbom/githubbotrevised">GitHub</a>.',
8385
parse_mode=ParseMode.HTML,
84-
disable_web_page_preview=True
86+
disable_web_page_preview=True,
87+
disable_notification=True
8588
)
8689

8790

@@ -120,7 +123,8 @@ def reply_handler(update: Update, context: CallbackContext):
120123
reply_markup=InlineKeyboardMarkup([[
121124
InlineKeyboardButton('Login', url=deep_link(context.bot, 'login'))
122125
]]),
123-
parse_mode=ParseMode.HTML)
126+
parse_mode=ParseMode.HTML,
127+
disable_notification=True)
124128
context.job_queue.run_once(delete_job, 30, sent_msg)
125129
return
126130

bot/menu.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,17 @@ def _attrs(self, update, context):
8181
def reply(self, update, context):
8282
context.menu_stack = getattr(context, 'menu_stack', []) + [self.name]
8383
return update.effective_message.reply_text(
84-
**self._attrs(update, context)
84+
**self._attrs(update, context),
85+
disable_notification=True
8586
)
8687

8788
def send(self, chat_id, context):
8889
context.menu_stack = getattr(context, 'menu_stack', []) + [self.name]
8990
update = Update(0)
9091
return context.bot.send_message(
9192
chat_id,
92-
**self._attrs(update, context)
93+
**self._attrs(update, context),
94+
disable_notification=True
9395
)
9496

9597
def edit(self, update, context):
@@ -257,5 +259,6 @@ def reply_menu(update, context, menu: Menu):
257259
def send_menu(chat_id, context, menu: Menu):
258260
return menu.send(chat_id, context)
259261

262+
260263
def edit_menu_by_id(chat_id, message_id, context, menu: Menu):
261-
return menu.edit_by_id(chat_id, message_id, context)
264+
return menu.edit_by_id(chat_id, message_id, context)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy