From 7d15dfd47674a6e4c23b4498a5d50459cdaca5f5 Mon Sep 17 00:00:00 2001 From: shoopea Date: Tue, 27 Aug 2019 11:39:20 +0800 Subject: [PATCH] add delete msg --- td.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/td.go b/td.go index dedc19a..e57aac7 100644 --- a/td.go +++ b/td.go @@ -195,13 +195,6 @@ func getHistory(c *tdlib.Client, chatID64 *int64, senderUserID64 *int64) { fmt.Printf("Exported %d messages.\n", msgCount) } -func DeleteMsg(c *tdlib.Client, chatID int64, msgID int64) { - msgIDs := make([]int64, 1) - msgIDs[0] = msgID - c.DeleteMessages(chatID, msgIDs, false) - fmt.Println("Deleting message ", msgID) -} - func OwnUserID(c *tdlib.Client) int32 { user, _ := c.GetMe() return user.ID @@ -237,6 +230,12 @@ func clientMsg(c *tdlib.Client, m TGCommand) { } else if m.ToUserID64 != 0 { c.SendMessage(m.ToUserID64, 0, false, false, nil, msgTxt) } + + case commandDeleteMsg: + msgIDs := make([]int64, 1) + msgIDs[0] = m.FromMsgID64 + c.DeleteMessages(m.FromChatID64, msgIDs, false) + case commandRefreshMsg: u, err := c.GetMessage(m.FromChatID64, m.FromMsgID64) logOnError(err, "ListenMQ : commandRefreshMsg")