td icon indicating copy to clipboard operation
td copied to clipboard

How to properly leave a group chat and remove this chat from chats list

Open dmitry-kovaliov opened this issue 3 years ago • 2 comments

Hi,

I use LeaveChat function to leave a group chat. This call removes user from the chat but leaves this chat in the chats list. I mean this chat remains visible in my application and official telegram client, at least for some time. It looks this way.

I tried to call DeleteChatHistory(chatId = xxx, removeFromChatList = true, revoke = false) function as soon as LeaveChat call completes. It removes the chat from the list and works well except some rare cases when DeleteChatHistory function fails with Chat info not found message.

I don't have any idea what is wrong in this case. Should I call DeleteChatHistory function when LeaveChat completes to remove chat from the list? Is it just a problem with DeleteChatHistory function call?

dmitry-kovaliov avatar Sep 22 '22 16:09 dmitry-kovaliov

Yes, if you want to delete the chat completely, you need to call DeleteChatHistory after LeaveChat is finished. If it returns "Chat info not found", then chat history can't be deleted, because it is already inaccessible.

levlam avatar Sep 23 '22 10:09 levlam

In fact, DeleteChatHistory is needed only for basic groups.

levlam avatar Sep 23 '22 10:09 levlam

Ok, thanks, I will just ignore this Chat info not found error, hope it will work without side effects. I think we can close this ticket.

dmitry-kovaliov avatar Sep 26 '22 08:09 dmitry-kovaliov

In fact, DeleteChatHistory is needed only for basic groups.

What about private supergroups?

zevlg avatar Sep 26 '22 09:09 zevlg

@zevlg It is impossible to keep access to messages in left supergroups regardless of their type.

levlam avatar Sep 27 '22 13:09 levlam