MCPcopy Index your code
hub / github.com/python-telegram-bot/python-telegram-bot / ChatLocation

Class ChatLocation

src/telegram/_chatlocation.py:33–89  ·  view source on GitHub ↗

This object represents a location to which a chat is connected. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`location` is equal. Args: location (:class:`telegram.Location`): The location to which the

Source from the content-addressed store, hash-verified

31
32
33class ChatLocation(TelegramObject):
34 """This object represents a location to which a chat is connected.
35
36 Objects of this class are comparable in terms of equality. Two objects of this class are
37 considered equal, if their :attr:`location` is equal.
38
39 Args:
40 location (:class:`telegram.Location`): The location to which the supergroup is connected.
41 Can't be a live location.
42 address (:obj:`str`): Location address;
43 :tg-const:`telegram.ChatLocation.MIN_ADDRESS`-
44 :tg-const:`telegram.ChatLocation.MAX_ADDRESS` characters, as defined by the chat owner.
45 Attributes:
46 location (:class:`telegram.Location`): The location to which the supergroup is connected.
47 Can't be a live location.
48 address (:obj:`str`): Location address;
49 :tg-const:`telegram.ChatLocation.MIN_ADDRESS`-
50 :tg-const:`telegram.ChatLocation.MAX_ADDRESS` characters, as defined by the chat owner.
51
52 """
53
54 __slots__ = ("address", "location")
55
56 def __init__(
57 self,
58 location: Location,
59 address: str,
60 *,
61 api_kwargs: JSONDict | None = None,
62 ):
63 super().__init__(api_kwargs=api_kwargs)
64 self.location: Location = location
65 self.address: str = address
66
67 self._id_attrs = (self.location,)
68
69 self._freeze()
70
71 @classmethod
72 def de_json(cls, data: JSONDict, bot: "Bot | None" = None) -> "ChatLocation":
73 """See :meth:`telegram.TelegramObject.de_json`."""
74 data = cls._parse_data(data)
75
76 data["location"] = de_json_optional(data.get("location"), Location, bot)
77
78 return super().de_json(data=data, bot=bot)
79
80 MIN_ADDRESS: Final[int] = constants.LocationLimit.MIN_CHAT_LOCATION_ADDRESS
81 """:const:`telegram.constants.LocationLimit.MIN_CHAT_LOCATION_ADDRESS`
82
83 .. versionadded:: 20.0
84 """
85 MAX_ADDRESS: Final[int] = constants.LocationLimit.MAX_CHAT_LOCATION_ADDRESS
86 """:const:`telegram.constants.LocationLimit.MAX_CHAT_LOCATION_ADDRESS`
87
88 .. versionadded:: 20.0
89 """

Callers 3

chat_locationFunction · 0.90
test_equalityMethod · 0.90

Calls

no outgoing calls

Tested by 2

chat_locationFunction · 0.72
test_equalityMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…