Closed PXNX closed 3 years ago
Seems like replacing line 185 in chat.py with
try:
data['pinned_messages']= Message.de_json(data.get('pinned_message'), bot)
except:
data['pinned_messages'] = None
fixes it.
Hi. This is a very strange error, because Message
is definetly a class and not a bool. Did you do something like telegram.Masseg = True
somewhere in your code? Can you provide a minimal reproducable example?
Here we go:
import os
import telegram
from telegram import Update
from telegram.ext import Updater, CommandHandler, CallbackContext
TOKEN = "TOKEN"
def test(update: Update, context: CallbackContext):
delay_group(update, context, "Fancy text")
def delay_group(update: Update, context: CallbackContext, text: str):
if update.message.reply_to_message:
update.message.reply_to_message.reply_text(
text=text,
parse_mode=telegram.ParseMode.HTML)
else:
reply_message = context.bot.send_message(
chat_id=update.message.chat_id,
text=text,
parse_mode=telegram.ParseMode.HTML)
context.job_queue.run_once(delete, 30, context=reply_message.chat_id, name=str(reply_message.message_id))
update.message.delete()
def delete(context: CallbackContext):
telegram.Message = context.bot.delete_message(chat_id=str(context.job.context), message_id=context.job.name)
if __name__ == '__main__':
updater = Updater(TOKEN, use_context=True)
dp = updater.dispatcher
dp.add_handler(CommandHandler("test", test))
PORT = int(os.environ.get('PORT', 5000))
updater.start_webhook(listen="0.0.0.0", port=PORT, url_path=TOKEN)
updater.bot.setWebhook('https://app-name.herokuapp.com/' + TOKEN)
updater.start_polling()
updater.idle()
Changing
def delete(context: CallbackContext):
telegram.Message = context.bot.delete_message(chat_id=str(context.job.context), message_id=context.job.name)
to
def delete(context: CallbackContext):
context.bot.delete_message(chat_id=str(context.job.context), message_id=context.job.name)
resolved this issue.
My bad. That was quite stupid.
Using 13.1 within an hour I get following error after which the bot does not respond anymore.