Skip to content

Instantly share code, notes, and snippets.

@Smosker Smosker/bug_test.py
Last active May 11, 2016

Embed
What would you like to do?
import time
import telepot
from telepot.namedtuple import ReplyKeyboardMarkup,InlineKeyboardMarkup,InlineKeyboardButton
TOKEN = 'Put your token here'
previous_message = {}
def handle(msg):
info = telepot.glance(msg)
if msg['text'] =='/start':
message = '''press on button below to see if bug working'''
show_keyboard = ReplyKeyboardMarkup(keyboard=[['Press me']])
bot.sendMessage(info[2], message, reply_markup=show_keyboard,
disable_web_page_preview=True)
if msg['text'] == 'Press me':
if previous_message.get(info[2],None):
print(previous_message[info[2]])
msgid = (info[2], previous_message[info[2]]['message_id'])
bot.editMessageReplyMarkup(msgid)
message = 'https://telegram.org/'
markup_keyboard = InlineKeyboardMarkup(inline_keyboard=
[[InlineKeyboardButton(text='Dont press me just click on "Press me" below again',
callback_data='bug_test')]])
previous_message[info[2]]=bot.sendMessage(info[2], message, reply_markup=markup_keyboard,disable_web_page_preview=True)
bot = telepot.Bot(TOKEN)
print(bot.getMe())
answerer = telepot.helper.Answerer(bot)
bot.message_loop({'chat': handle,
'callback_query': None,
'inline_query': None,
'chosen_inline_result': None})
while 1:
time.sleep(10)
@Smosker

This comment has been minimized.

Copy link
Owner Author

Smosker commented May 11, 2016

Problem - when sendind new message with inline keyboard i want get rid of inline keyboard in previous message with it, so i use method "editMessageReplyMarkup" passing it user id amd message id - and it works normal but problem is that it seems to turn off setting "disable_web_page_preview=True" in this message (which keyboard i edit)

Video web version - https://yadi.sk/d/D8MtBBvnrczTu
Video desctop mac - https://yadi.sk/d/caRCcAzvrczck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.