MCPcopy Create free account
hub / github.com/eternnoir/pyTelegramBotAPI / get_state

Method get_state

telebot/__init__.py:8736–8771  ·  view source on GitHub ↗

Gets current state of a user. Not recommended to use this method. But it is ok for debugging. .. warning:: Even if you are using :class:`telebot.types.State`, this method will return a string. When comparing(not recommended), you should compare this

(self, user_id: int, chat_id: Optional[int]=None,
                    business_connection_id: Optional[str]=None,
                    message_thread_id: Optional[int]=None, bot_id: Optional[int]=None)

Source from the content-addressed store, hash-verified

8734
8735
8736 def get_state(self, user_id: int, chat_id: Optional[int]=None,
8737 business_connection_id: Optional[str]=None,
8738 message_thread_id: Optional[int]=None, bot_id: Optional[int]=None) -> str:
8739 """
8740 Gets current state of a user.
8741 Not recommended to use this method. But it is ok for debugging.
8742
8743 .. warning::
8744
8745 Even if you are using :class:`telebot.types.State`, this method will return a string.
8746 When comparing(not recommended), you should compare this string with :class:`telebot.types.State`.name
8747
8748 :param user_id: User's identifier
8749 :type user_id: :obj:`int`
8750
8751 :param chat_id: Chat's identifier
8752 :type chat_id: :obj:`int`
8753
8754 :param bot_id: Bot's identifier, defaults to current bot id
8755 :type bot_id: :obj:`int`
8756
8757 :param business_connection_id: Business identifier
8758 :type business_connection_id: :obj:`str`
8759
8760 :param message_thread_id: Identifier of the message thread
8761 :type message_thread_id: :obj:`int`
8762
8763 :return: state of a user
8764 :rtype: :obj:`int` or :obj:`str` or :class:`telebot.types.State`
8765 """
8766 if chat_id is None:
8767 chat_id = user_id
8768 if bot_id is None:
8769 bot_id = self.bot_id
8770 return self.current_states.get_state(chat_id, user_id,
8771 bot_id=bot_id, business_connection_id=business_connection_id, message_thread_id=message_thread_id)
8772
8773
8774 def add_data(self, user_id: int, chat_id: Optional[int]=None,

Callers 2

checkMethod · 0.45
checkMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected