Skip to content

Commit 4d2d251

Browse files
committed
telegram bot configured
1 parent a853dd2 commit 4d2d251

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

examples/logging_and_report/telegram_2e4148e2.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def execute(self):
2626
cmd = None
2727
specificConfig = self.config.get('SpecificConfig')
2828
chat_ids = SetPersist('chat_ids')
29+
callback_short_report = '5m'
2930

3031
if not specificConfig:
3132

@@ -51,7 +52,7 @@ def start(update: Update, context: CallbackContext):
5152
# buttonb = KeyboardButton()
5253
# keyboard = [[keyboardButton]]
5354
# reply_markup = ReplyKeyboardMarkup(keyboard)
54-
data_short_report = 'A unique text for help button callback data'
55+
data_short_report = '5m'
5556
report_button = InlineKeyboardButton(
5657
text='Request Report: 5min', # text that show to user
5758
callback_data=data_short_report # text that send to bot when user tap button
@@ -75,11 +76,17 @@ def message(update, context):
7576
def callback_query_handler(update, context):
7677

7778
data = update.callback_query.data
78-
context.bot.answer_callback_query(
79-
callback_query_id = update.callback_query.id,
80-
text = 'Preparing report...'
81-
)
79+
if data == callback_short_report:
80+
81+
context.bot.answer_callback_query(
82+
callback_query_id = update.callback_query.id,
83+
text = 'Preparing report...'
84+
)
8285

86+
guitext = GuiCMD('Report request from: {}'.format(update.callback_query.from_user.first_name))
87+
self.return_queue.put(guitext)
88+
record = Record(data, 'Report request from: {}'.format(update.callback_query.from_user.first_name))
89+
self.return_queue.put(record)
8390

8491

8592
start_handler = CommandHandler('start', start) # handler for the start command

0 commit comments

Comments
 (0)