[tg教學] 如何刪除Telegram群組/頻道中所有或部分聊天記錄

Khermit
0110 Tech
Published in
5 min readSep 5, 2019

Telegram的群組和頻道沒有限時訊息/訊息閱後自動焚毀(self-destruct message)功能,也只能清掉已方的聊天記錄(chat history)。有時需要刪掉所有或部分聊天記錄,如果是朋友間的小群組可以刪掉重開新群組解決,但如果是大型群組或頻道只能靠bot。

(2019年10月1日更新:關於私人群組使用 “/delall” 時或需修改 “Chat History For New Members”的設定和相關注意事項。)

必要條件

  • 有可以加新Admin的權限(Owner/可加新Admin的Admin)

步驟

  • 1. 進入自己的群組/頻道,去 “Group Info” > 按右上角“Edit” > 按“Administrators”
  • 2. 按“Add Admin”,在search bar輸入“@delall_bot”,然後按 “Delall bot”
  • 3. 然後設定權限。給予“Delete Messages”, “Add Members”, “Add New Admins”權限。然後按右上角“Done”。(如用在頻道,可以增加“Post Messages”權限,出現問題時可以看到有用資訊。)(請看注意事項

使用方法

刪除所有訊息

如果是私人群組(private groups),需要去Group Info>Edit>Chat History For New Members,將設定改成 “Visible”。(詳細解說看注意事項

  • 輸入command “/delall”,然後送出。
輸入command “/delall”,然後送出。

刪除某訊息及此後的訊息

  • 選擇回覆某條訊息,輸入command “/delfrom”,然後送出。
選擇回覆某條訊息,輸入command “/delfrom”,然後送出。

注意事項

  • 由於所有群組中的成員都可以使用command,為了防止濫用:
    -可以需要時才將Delall bot加入群組;或
    -不給予“Add New Admins”權限
  • 可以在需要使用 “/delall” 時才將 “Chat History For New Members”改成 “Visible”。
    或用search的尋找特定日期功能,找到群組內第一個訊息後用“/delfrom”。
    開發者解說如下:

To use the /delall command, the userbot must have access to the whole chat history.
The reason for this is simple: if it always started deleting from message ID 1 and you used the command twice, the second time it would try to delete the message it deleted the first time, again.
This would result in the userbot being apparently inactive for a long time, while it is in fact trying to delete already-deleted messages.
To solve this, the userbot gets the ID of the first existing message and starts deleting from there: that’s what it needs the history for.

If you don’t want to make the history available, you can use /delfrom in reply to the first message instead.

https://t.me/delall_bot?start=history

  • 在其他人的裝置上或會有部分較舊訊息無法刪除,要個別人士自行清除訊息記錄。(這個問題可能是因為其他裝置上還有cache。)
在其他人的裝置上或會有部分較舊訊息無法刪除,要個別人士自行清除訊息記錄。

--

--