Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Dec 23, 2024. It is now read-only.

Add method to set the History TTL #681

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

ColinShark
Copy link
Contributor

app.set_history_ttl(chat_id, period) to automatically delete messages after either a day (86400) or a week (604800). 0 to disable.

`app.set_history_ttl(chat_id, period)` to automatically delete messages
after either a day or a week. 0 to disable.
@delivrance
Copy link
Member

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.

ColinShark and others added 5 commits May 14, 2021 17:55
@@ -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):
Copy link
Member

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.

Copy link
Member

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants