Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c448bba
Update types.py
coder2020official Apr 12, 2025
805c78f
Add business account methods
coder2020official Apr 12, 2025
1d32718
Added AcceptedGiftTypes and set_business_account_gift_settings
coder2020official Apr 12, 2025
3e0f06a
Add get_business_account_star_balance
coder2020official Apr 12, 2025
af858de
Added transfer_business_account_stars
coder2020official Apr 12, 2025
c012a59
Added get_business_account_gifts, OwnedGiftRegular, OwnedGiftUnique, …
coder2020official Apr 12, 2025
3d238a4
Added convert_gift_to_stars
coder2020official Apr 12, 2025
817f2ad
Added upgrade_gift and transfer_gift methods
coder2020official Apr 12, 2025
b47c73f
Added InputStoryContent
coder2020official Apr 12, 2025
1713909
Stories
coder2020official Apr 12, 2025
1c08163
posting, editing, deleting stories(needs testing)
coder2020official Apr 12, 2025
b05d209
Replaced the field can_send_gift with the field accepted_gift_types …
coder2020official Apr 12, 2025
6fedece
Added unique_gift and gift
coder2020official Apr 12, 2025
e3d7f96
Added gift_premium_subscription
coder2020official Apr 12, 2025
f76cac8
Added premium_subscription_duration to TransactionPartnerUser
coder2020official Apr 12, 2025
0bd9133
Added transaction_type to TransactionPartnerUser
coder2020official Apr 12, 2025
950d7c6
Added paid_message_price_changed
coder2020official Apr 12, 2025
9fb4fdd
Added paid_star_count
coder2020official Apr 12, 2025
0d1e515
Added set_business_account_profile_photo and remove_business_account_…
coder2020official Apr 12, 2025
d63b07a
Fix issues with posting stories
coder2020official Apr 13, 2025
49684b5
Fix stories for async
coder2020official Apr 13, 2025
533b52c
Fix issues related with Bot api 9.0
coder2020official Apr 19, 2025
d4f5ead
Fix typehints
coder2020official Apr 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions telebot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9651,3 +9651,4 @@ def _notify_command_handlers(self, handlers, new_messages, update_type):
handlers=handlers,
middlewares=middlewares,
update_type=update_type)

90 changes: 90 additions & 0 deletions telebot/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -11773,6 +11773,96 @@ def de_json(cls, json_string):
obj = cls.check_json(json_string)
obj['colors'] = UniqueGiftBackdropColors.de_json(obj['colors'])
return cls(**obj)

class InputStoryContent(JsonSerializable):
Comment thread
coder2020official marked this conversation as resolved.
Outdated
"""
This object describes the content of a story to post. Currently, it can be one of
InputStoryContentPhoto
InputStoryContentVideo

Telegram documentation: https://core.telegram.org/bots/api#inputstorycontent

"""


class InputStoryContentPhoto(InputStoryContent):
"""
This object describes a photo to post as a story.

Telegram documentation: https://core.telegram.org/bots/api#inputstorycontentphoto

:param photo: The photo to post as a story. The photo must be of the size 1080x1920 and must not exceed 10 MB. The photo can't be reused and can only be uploaded as a new file, so you can pass “attach://<file_attach_name>” if the photo was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files
:type photo: :obj:`str`
Comment thread
coder2020official marked this conversation as resolved.
Outdated

:return: Instance of the class
:rtype: :class:`InputStoryContentPhoto`
"""
def __init__(self, photo: InputFile, **kwargs):
self.type: str = "photo"
Comment thread
Badiboy marked this conversation as resolved.
Outdated
self.photo: InputFile = photo
self._photo_name = service_utils.generate_random_token()
self._photo_dic = "attach://{}".format(self._photo_name)

def to_json(self):
return json.dumps(self.to_dict())

def to_dict(self):
data = {
'type': self.type,
'photo': self._photo_dic
}
return data

def convert_input_story(self):
return self.to_json(), {self._photo_name: self.photo}


class InputStoryContentVideo(InputStoryContent):
"""
This object describes a video to post as a story.

Telegram documentation: https://core.telegram.org/bots/api#inputstorycontentvideo

:param video: The video to post as a story. The video must be of the size 720x1280, streamable, encoded with H.265 codec, with key frames added each second in the MPEG4 format, and must not exceed 30 MB. The video can't be reused and can only be uploaded as a new file, so you can pass “attach://<file_attach_name>” if the video was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files
:type video: :obj:`str`
Comment thread
coder2020official marked this conversation as resolved.
Outdated

:param duration: Optional. Precise duration of the video in seconds; 0-60
:type duration: :obj:`float`

:param cover_frame_timestamp: Optional. Timestamp in seconds of the frame that will be used as the static cover for the story. Defaults to 0.0.
:type cover_frame_timestamp: :obj:`float`

:param is_animation: Optional. Pass True if the video has no sound
:type is_animation: :obj:`bool`

:return: Instance of the class
:rtype: :class:`InputStoryContentVideo`
"""
def __init__(self, video: InputFile, duration: Optional[float] = None, cover_frame_timestamp: Optional[float] = None,
is_animation: Optional[bool] = None, **kwargs):
self.type: str = "video"
self.video: InputFile = video
self._video_name = service_utils.generate_random_token()
self._video_dic = "attach://{}".format(self._video_name)
self.duration: Optional[float] = duration
self.cover_frame_timestamp: Optional[float] = cover_frame_timestamp
self.is_animation: Optional[bool] = is_animation
def to_json(self):
return json.dumps(self.to_dict())

def to_dict(self):
data = {
'type': self.type,
'video': self._video_dic
}
if self.duration is not None:
Comment thread
Badiboy marked this conversation as resolved.
data['duration'] = self.duration
if self.cover_frame_timestamp is not None:
data['cover_frame_timestamp'] = self.cover_frame_timestamp
if self.is_animation is not None:
data['is_animation'] = self.is_animation
return data
def convert_input_story(self):
return self.to_json(), {self._video_name: self.video}