telegram.ext.messagehandler module¶
This module contains the MessageHandler class
-
class
telegram.ext.messagehandler.MessageHandler(filters, callback, allow_edited=False, pass_update_queue=False, pass_job_queue=False, pass_user_data=False, pass_chat_data=False, message_updates=True, channel_posts_updates=True)¶ Bases:
telegram.ext.handler.HandlerHandler class to handle telegram messages. Messages are Telegram Updates that do not contain a command. They might contain text, media or status updates.
Parameters: - filters (telegram.ext.BaseFilter) – A filter inheriting from
telegram.ext.filters.BaseFilter. Standard filters can be found intelegram.ext.filters.Filters. Filters can be combined using bitwise operators (& for and, | for or). - callback (function) – A function that takes
bot, updateas positional arguments. It will be called when thecheck_updatehas determined that an update should be processed by this handler. - allow_edited (Optional[bool]) – If the handler should also accept edited messages.
Default is
False - pass_update_queue (optional[bool]) – If the handler should be passed the
update queue as a keyword argument called
update_queue. It can be used to insert updates. Default isFalse - pass_user_data (optional[bool]) – If set to
True, a keyword argument calleduser_datawill be passed to the callback function. It will be adictyou can use to keep any data related to the user that sent the update. For each update of the same user, it will be the samedict. Default isFalse. - pass_chat_data (optional[bool]) – If set to
True, a keyword argument calledchat_datawill be passed to the callback function. It will be adictyou can use to keep any data related to the chat that the update was sent in. For each update in the same chat, it will be the samedict. Default isFalse. - message_updates (Optional[bool]) – Should “normal” message updates be handled? Default is
True. - channel_posts_updates (Optional[bool]) – Should channel posts updates be handled? Default is
True.
-
checkUpdate(*args, **kwargs)¶
-
check_update(update)¶
-
handleUpdate(*args, **kwargs)¶
-
handle_update(update, dispatcher)¶
-
m= 'telegram.MessageHandler.'¶
- filters (telegram.ext.BaseFilter) – A filter inheriting from