Home>

Actually the problem, I am making a game bot in Telegram in Python using the telebot library. Everything is fine except for one thing, on the phone (there is no such problem on a computer), during the countdown of the timer (the timer is implemented through a separate thread that edits the message once a second) a phantom button appears, which cannot be pressed in time, but it is incredibly annoying to look at. I don’t know how this button appears on a message, I don’t use any reply_markup for this message, so the appearance of this button raises questions, is it possible to somehow solve this problem? This is how a thread is implemented that edits a message once a second:

class Service_Thread(Thread):
    def run(self):
        global count, Flag, globalid, globalcall, globalhert, photoid, currentfilm, score,globalData
        while Flag:
            if (len(globalhert)== 0):
                mrk= telebot.types.InlineKeyboardMarkup()
                mrk.add(telebot.types.InlineKeyboardButton(text='Повторить', callback_data='Next'))
                mrk.add(telebot.types.InlineKeyboardButton(text='Закончить',callback_data='End'))
                genus=Genus()
                bot.edit_message_text(chat_id=globalcall.message.chat.id, message_id=globalid.id,
                                      text=f'Правильный ответ: {globalData[0][currentfilm]}.\nВы угадали {score} {genus} , хотите повторить?', reply_markup=mrk)
                bot.delete_message(chat_id=globalcall.message.chat.id, message_id=photoid.id)
                break
            elif (count== 0):
                count += 10
                globalhert= globalhert[:-1]
            count -= 1
            time.sleep(1)
            sekinmin= time.ctime(count)
            sekinmin= sekinmin[sekinmin.find('1 03:') + 5:sekinmin.find(' 1970')]
            bot.edit_message_text(chat_id=globalcall.message.chat.id, message_id=globalid.id,text=f"{globalhert}              {sekinmin}")

I start it in another part of the code like this: Service_Thread (). start ()

In what language, at least?

ПИТОНИСТ версия 3-82021-11-25 11:00:52

I'm using Python

Bol4onok2021-11-25 11:01:29

Add a minimal, self-contained and reproducible example (button edit)

gil9red2021-11-25 11:10:23