T
T
the_extreames2018-09-23 16:52:31
Python
the_extreames, 2018-09-23 16:52:31

How to fix the error when issuing a mut?

Hello, I have this code:

@bot.message_handler(commands=["pmute"])
def handle_text(message):
    mute = bot.send_message(message.chat.id, privacy.pbanforid)
    bot.register_next_step_handler(mute, timem)

def timem(message):
     timec = bot.send_message(message.chat.id, privacy.pbanforid)
     bot.register_next_step_handler(timec, mutea)

def mutea(message):
    bot.restrict_chat_member(message.chat.id, '{muteid}'.format(muteid=message.text), until_date=time()+ '{sec}'.format(sec=message.text))

At which, I write /pmute, the bot responds, enter the ID of the person, I write, after which it asks the time. But after I write the time, the following error pops up:
2018-09-23 16:48:25,495 (util.py:65 WorkerThread2) ERROR - TeleBot: "TypeError occurred, args=("unsupported operand type(s) for +: 'float' and 'str'",)
Traceback (most recent call last):
File "C:\Users\Helle\ AppData\Local\Programs\Python\Python37-32\lib\site-packages\telebot\util.py", line 59, in run
task(*args, **kwargs)
File "C:/Users/Helle/PycharmProjects/ BOT/botEX/main.py", line 63, in mutea
bot.restrict_chat_member(message.chat.id, '{muteid}'.format(muteid=message.text), until_date=time()+ '{sec}' .format(sec=message.text)) #621330381
TypeError: unsupported operand type(s) for +: 'float' and 'str'
"
Traceback (most recent call last):
File "C:/Users/Helle/PycharmProjects/BOT/botEX/main.py", line 108, in
bot.polling(none_stop=True, interval=0)
File "C:\Users\Helle\AppData\Local\Programs\Python\Python37-32\lib\site-packages\telebot\__init__.py", line 389, in polling
self.__threaded_polling(none_stop, interval, timeout)
File "C:\Users\Helle\AppData\Local\Programs\Python\Python37-32\lib\site-packages\telebot\__init__.py", line 413, in __threaded_polling
self.worker_pool.raise_exceptions()
File "C:\Users\Helle\AppData\Local\Programs\Python\Python37-32\lib\site-packages\telebot\util.py", line 108,in raise_exceptions
six.reraise(self.exc_info[0], self.exc_info[1], self.exc_info[2])
File "C:\Users\Helle\AppData\Local\Programs\Python\Python37-32\lib\site- packages\six.py", line 693, in reraise
raise value
File "C:\Users\Helle\AppData\Local\Programs\Python\Python37-32\lib\site-packages\telebot\util.py", line 59 , in run
task(*args, **kwargs)
File "C:/Users/Helle/PycharmProjects/BOT/botEX/main.py", line 63, in mutea
bot.restrict_chat_member(message.chat.id, '{muteid }'.format(muteid=message.text), until_date=time()+ '{sec}'.format(sec=message.text)) #621330381
TypeError: unsupported operand type(s) for +: 'float' and 'str'
Help fix

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question