-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add method to set the History TTL #681
base: master
Are you sure you want to change the base?
Conversation
`app.set_history_ttl(chat_id, period)` to automatically delete messages after either a day or a week. 0 to disable.
I'm also not fully convinced about keeping "TTL" in the convenience API, but at the moment I can't think of a better and short enough replacement. |
`set_history_ttl` -> `set_chat_history_ttl` in all occurences
(Still the original name ha!)
@@ -498,6 +501,9 @@ async def _parse( | |||
elif isinstance(action, raw.types.MessageActionInviteToGroupCall): | |||
voice_chat_members_invited = types.VoiceChatMembersInvited._parse(client, action, users) | |||
service_type = "voice_chat_members_invited" | |||
elif isinstance(action, raw.types.MessageActionSetMessagesTTL): |
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.
Reading this made me think that maybe we should rename the whole thing to set_chat_messages_ttl
or just set_chat_ttl
since the feature applies to new messages not to the whole history (or can be seen as a global chat setting regardless of messages or history). What do you think? There's also a ttl_period
field for messages (see the raw Message object) which I guess it will be set for all new messages when ttl is enabled.
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.
So, set_chat_ttl()
, Chat.set_ttl()
, Message.chat_ttl_period
.
app.set_history_ttl(chat_id, period)
to automatically delete messages after either a day (86400
) or a week (604800
).0
to disable.