Can add/delete chat

This commit is contained in:
Yang Luo
2023-04-23 01:19:44 +08:00
parent 0ee98e2582
commit 06ebc04032
4 changed files with 129 additions and 78 deletions

View File

@ -135,6 +135,10 @@ func DeleteChat(chat *Chat) bool {
panic(err)
}
if affected != 0 {
return DeleteChatMessages(chat.Name)
}
return affected != 0
}

View File

@ -143,6 +143,15 @@ func DeleteMessage(message *Message) bool {
return affected != 0
}
func DeleteChatMessages(chat string) bool {
affected, err := adapter.Engine.Delete(&Message{Chat: chat})
if err != nil {
panic(err)
}
return affected != 0
}
func (p *Message) GetId() string {
return fmt.Sprintf("%s/%s", p.Owner, p.Name)
}