telegram.ext.dispatcher - ERROR - No error handlers are registered, logging exception.
Traceback (most recent call last):
File "c:/bot/bot.py", line 35, in answer
bot.forward_message(i, message.chat.id, disable_notification=True, message_id=message.message_id)
File "", line 2, in forward_message
File "C:\Users\shostakniko\AppData\Local\Programs\Python\Python38\lib\site-packages\telegram\bot.py", line 67, in decorator
result = func(*args, **kwargs)
File "C:\Users\shostakniko\AppData\Local\Programs\Python\Python38\lib\site-packages\telegram\bot.py", line 421, in forward_message
return self._message(url, data, disable_notification=disable_notification,
File "C:\Users\shostakniko\AppData\Local\Programs\Python\Python38\lib\site-packages\telegram\bot.py", line 172, in _message
result = self._request.post(url, data, timeout=timeout)
File "C:\Users\shostakniko\AppData\Local\Programs\Python\Python38\lib\site-packages\telegram\utils\request.py", line 331, in post
result = self._request_wrapper('POST', url,
File "C:\Users\shostakniko\AppData\Local\Programs\Python\Python38\lib\site-packages\telegram\utils\request.py", line 245, in _request_wrapper
raise BadRequest(message)
telegram.error.BadRequest: Chat not found
There is no way, to get all the users via a API method. However, if you're using persistence since lauching your bot,context.dispatcher.chat_data.keys()
will be a list (well, actually a dictkeys object) with all the chat ids that triggered an update, that was handled by your bot and similarly forcontext.dispatcher.user_data.keys()
. The important part here is, that users that only sent messages that your bot ignores, wont be listed. Also, there is no guarantee that a user hasn't blocked your bot in the mean time, so you should wrap each send_message in a try ... except, when iterating over all your users.
from telegram import ReplyKeyboardMarkup
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
import constants, texts, base_work
import logging
import random
mail = cit = lol = lol1 = False
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO)
updater = Updater(token=constants.token)
dispatcher = updater.dispatcher
как оформить так что бы все?
all id из base_work