-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bot API 6.8: Stories, voting as a chat, and other minor changes #2030
Conversation
@Badiboy can you clarify one thing: what is the purpose of to_dict in types.PollAnswer? Check previous commit where I added voter_chat, and if to_dict is necessary I have to add to_dict for types.Chat. I have checked api doc and I see no need for to_dict for PollAnswer, since it is an update. Or did I miss something? |
I guess I am done except for the PollAnswer issue I described above. |
It was long long time ago. :) They are not needed in library. And I suppose they are not used by anybody. |
The same you can check user.to_dict/to_json if you want to, I do not remember what's with these methods usage. |
telebot/types.py
Outdated
|
||
@classmethod | ||
def de_json(cls, json_string): | ||
return cls() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
telebot/types.py
Outdated
for key in options: | ||
setattr(self, key, options[key]) | ||
self.json = json_string | ||
|
||
@property | ||
def is_forwarded_story(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See no reason in appearance of this property... No is_anumation, is_video, is_xxx - why now is_story?
@@ -6710,12 +6713,16 @@ def de_json(cls, json_string): | |||
if (json_string is None): return None | |||
obj = cls.check_json(json_string) | |||
obj['user'] = User.de_json(obj['user']) | |||
if 'voter_chat' in obj: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
User is now optional and should be processed the same as voter_chat with if
telebot/types.py
Outdated
return cls(**obj) | ||
|
||
def __init__(self, poll_id, user, option_ids, **kwargs): | ||
def __init__(self, poll_id, user, option_ids, voter_chat=None, **kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And user is optional here also... Seems we need to change init signature.
telebot/types.py
Outdated
return cls(**obj) | ||
|
||
def __init__(self, poll_id, user, option_ids, **kwargs): | ||
def __init__(self, poll_id, user, option_ids, voter_chat=None, **kwargs): | ||
self.poll_id: str = poll_id | ||
self.user: User = user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here...
@coder2020official I submitted review. If you don't see it let me know, means I did something wrong again ) |
@Badiboy i guess I am done, I removed the is_forwarded_story option(found it useless after ur comment), made user optional, improved new story class to check for json. Check the previous commit for more |
August 18, 2023
Bot API 6.8
Added the field story to the class Message for messages with forwarded stories. Currently, it holds no information.
Added the field voter_chat to the class PollAnswer, to contain channel chat voters in Polls. For backward compatibility, the field user in such objects will contain the user 136817688 (@Channel_Bot).
Added the field emoji_status_expiration_date to the class Chat.
Added the method unpinAllGeneralForumTopicMessages.
Increased to 512 characters the maximum length of the startapp parameter in direct Web App links(NOT NEEDED)