forked from JosXa/BotListBot
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmisc.py
More file actions
28 lines (23 loc) · 1.27 KB
/
Copy pathmisc.py
File metadata and controls
28 lines (23 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from telegram import InlineKeyboardButton, InlineKeyboardMarkup
from telegram.ext import ConversationHandler
import util
from const import CallbackActions
def manage_subscription(bot, update):
chat_id = update.effective_chat.id
user_id = update.effective_user.id
if util.is_group_message(update):
admins = bot.get_chat_administrators(chat_id)
if user_id not in admins:
bot.send_failure(chat_id, "Sorry, but only Administrators of this group are allowed "
"to manage subscriptions.")
return
text = "Would you like to be notified when new bots arrive at the @BotList?"
buttons = [[
InlineKeyboardButton(util.success("Yes"),
callback_data=util.callback_for_action(CallbackActions.SET_NOTIFICATIONS,
{'value': True})),
InlineKeyboardButton("No", callback_data=util.callback_for_action(CallbackActions.SET_NOTIFICATIONS,
{'value': False}))]]
reply_markup = InlineKeyboardMarkup(buttons)
msg = util.send_md_message(bot, chat_id, text, reply_markup=reply_markup)
return ConversationHandler.END