add delete msg

This commit is contained in:
shoopea 2019-08-27 11:39:20 +08:00
parent edfd1cb34f
commit 7d15dfd476

13
td.go
View File

@ -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")