telegramlib.get_chat

telegramlib.get_chat(user=None, last=None, last_message=None, max_char=None, to_string=False, to_list=False, only_name_keys=False, without_keys=False)[source]

Get the chat history of a user.

Parameters:
  • user (int or str or None, optional) – user_id of the user whose chat to get or None (default) to use config._user_id.

  • last (int or str or None, optional) – Number of last messages or last “day”, “month”, or “year” time frame (default is None).

  • last_message (str, optional) – Last message of which you want to get the next ones (default is None).

  • max_char (int, optional) – Maximum number of characters to be obtained (default is None).

  • to_string (bool, optional) – True to return the chat in string format (default is False).

  • to_list (bool, optional) – True to return the chat in list format (default is False).

  • only_name_keys (bool, optional) – True to return chat with keys containing only names (default is False).

  • without_keys (bool, optional) – True to return the chat with only message contents (default is False).

Returns:

The user’s chat in the specified format.

Return type:

dict or str or list