This commit is contained in:
Karmanyaah Malhotra 2021-04-21 14:40:57 -04:00
parent 8346b308c8
commit f924cc63f8
2 changed files with 13 additions and 4 deletions

View File

@ -32,7 +32,7 @@
* [x] Random Files
* [x] Location messages<sup>1</sup>
* [ ] Polls<sup>3</sup>
* [ ] Replies
* [x] Replies
* [ ] Chat types
* [ ] Private chat
* [x] Group chat

View File

@ -1090,11 +1090,11 @@ func (portal *Portal) MainIntent() *appservice.IntentAPI {
return portal.bridge.Bot
}
func (portal *Portal) SetReply(content *event.MessageEventContent, info whatsapp.ContextInfo) {
if len(info.QuotedMessageID) == 0 {
func (portal *Portal) SetReply(content *event.MessageEventContent, msgID types.GroupMeID) {
if len(msgID) == 0 {
return
}
message := portal.bridge.DB.Message.GetByJID(portal.Key, info.QuotedMessageID)
message := portal.bridge.DB.Message.GetByJID(portal.Key, msgID)
if message != nil {
evt, err := portal.MainIntent().GetEvent(portal.MXID, message.MXID)
if err != nil {
@ -1394,6 +1394,15 @@ func (portal *Portal) handleAttachment(intent *appservice.IntentAPI, attachment
}
return content, false, nil
case "reply":
fmt.Printf("%+v\n", attachment)
content := &event.MessageEventContent{
Body: message.Text,
MsgType: event.MsgText,
}
portal.SetReply(content, attachment.ReplyID.String())
return content, false, nil
default:
portal.log.Warnln("Unable to handle groupme attachment type", attachment.Type)
return nil, true, fmt.Errorf("Unable to handle groupme attachment type %s", attachment.Type)