delete old list correctly
This commit is contained in:
parent
ab75014a19
commit
37cad43fbf
10
main.go
10
main.go
@ -139,6 +139,10 @@ func handleTextAdded(gl *glist.GList, text string) {
|
||||
defer gl.Mutex.Unlock()
|
||||
if count == gl.AllMsgCounter {
|
||||
sendList(gl, "sendMessage")
|
||||
if gl.MessageID != nil {
|
||||
deleteMessage(gl.ChatID, *gl.MessageID)
|
||||
gl.MessageID = nil
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -146,11 +150,6 @@ func handleTextAdded(gl *glist.GList, text string) {
|
||||
func handleButtonClick(gl *glist.GList, messageID int, text string) {
|
||||
gl.Mutex.Lock()
|
||||
defer gl.Mutex.Unlock()
|
||||
if gl.MessageID != nil {
|
||||
if messageID != *gl.MessageID {
|
||||
go deleteMessage(gl.ChatID, *gl.MessageID)
|
||||
}
|
||||
}
|
||||
gl.MessageID = &messageID
|
||||
if text == "clear" {
|
||||
gl.ClearChecked()
|
||||
@ -161,6 +160,7 @@ func handleButtonClick(gl *glist.GList, messageID int, text string) {
|
||||
|
||||
if len(gl.Items) == 0 {
|
||||
deleteMessage(gl.ChatID, messageID)
|
||||
gl.MessageID = nil
|
||||
} else {
|
||||
sendList(gl, "editMessageText")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user