This object contains information about a chat boost. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`boost_id`, :attr:`add_date`, :attr:`expiration_date`, and :attr:`source` are equal. .. versionadded::
| 237 | |
| 238 | |
| 239 | class ChatBoost(TelegramObject): |
| 240 | """ |
| 241 | This object contains information about a chat boost. |
| 242 | |
| 243 | Objects of this class are comparable in terms of equality. Two objects of this class are |
| 244 | considered equal, if their :attr:`boost_id`, :attr:`add_date`, :attr:`expiration_date`, |
| 245 | and :attr:`source` are equal. |
| 246 | |
| 247 | .. versionadded:: 20.8 |
| 248 | |
| 249 | Args: |
| 250 | boost_id (:obj:`str`): Unique identifier of the boost. |
| 251 | add_date (:obj:`datetime.datetime`): Point in time when the chat was boosted. |
| 252 | expiration_date (:obj:`datetime.datetime`): Point in time when the boost |
| 253 | will automatically expire, unless the booster's Telegram Premium subscription is |
| 254 | prolonged. |
| 255 | source (:class:`telegram.ChatBoostSource`): Source of the added boost. |
| 256 | |
| 257 | Attributes: |
| 258 | boost_id (:obj:`str`): Unique identifier of the boost. |
| 259 | add_date (:obj:`datetime.datetime`): Point in time when the chat was boosted. |
| 260 | |datetime_localization| |
| 261 | expiration_date (:obj:`datetime.datetime`): Point in time when the boost |
| 262 | will automatically expire, unless the booster's Telegram Premium subscription is |
| 263 | prolonged. |datetime_localization| |
| 264 | source (:class:`telegram.ChatBoostSource`): Source of the added boost. |
| 265 | """ |
| 266 | |
| 267 | __slots__ = ("add_date", "boost_id", "expiration_date", "source") |
| 268 | |
| 269 | def __init__( |
| 270 | self, |
| 271 | boost_id: str, |
| 272 | add_date: dtm.datetime, |
| 273 | expiration_date: dtm.datetime, |
| 274 | source: ChatBoostSource, |
| 275 | *, |
| 276 | api_kwargs: JSONDict | None = None, |
| 277 | ): |
| 278 | super().__init__(api_kwargs=api_kwargs) |
| 279 | |
| 280 | self.boost_id: str = boost_id |
| 281 | self.add_date: dtm.datetime = add_date |
| 282 | self.expiration_date: dtm.datetime = expiration_date |
| 283 | self.source: ChatBoostSource = source |
| 284 | |
| 285 | self._id_attrs = (self.boost_id, self.add_date, self.expiration_date, self.source) |
| 286 | self._freeze() |
| 287 | |
| 288 | @classmethod |
| 289 | def de_json(cls, data: JSONDict, bot: "Bot | None" = None) -> "ChatBoost": |
| 290 | """See :meth:`telegram.TelegramObject.de_json`.""" |
| 291 | data = cls._parse_data(data) |
| 292 | |
| 293 | data["source"] = de_json_optional(data.get("source"), ChatBoostSource, bot) |
| 294 | loc_tzinfo = extract_tzinfo_from_defaults(bot) |
| 295 | data["add_date"] = from_timestamp(data.get("add_date"), tzinfo=loc_tzinfo) |
| 296 | data["expiration_date"] = from_timestamp(data.get("expiration_date"), tzinfo=loc_tzinfo) |
no outgoing calls
searching dependent graphs…