Replies
This commit is contained in:
parent
8346b308c8
commit
f924cc63f8
@ -32,7 +32,7 @@
|
|||||||
* [x] Random Files
|
* [x] Random Files
|
||||||
* [x] Location messages<sup>1</sup>
|
* [x] Location messages<sup>1</sup>
|
||||||
* [ ] Polls<sup>3</sup>
|
* [ ] Polls<sup>3</sup>
|
||||||
* [ ] Replies
|
* [x] Replies
|
||||||
* [ ] Chat types
|
* [ ] Chat types
|
||||||
* [ ] Private chat
|
* [ ] Private chat
|
||||||
* [x] Group chat
|
* [x] Group chat
|
||||||
|
15
portal.go
15
portal.go
@ -1090,11 +1090,11 @@ func (portal *Portal) MainIntent() *appservice.IntentAPI {
|
|||||||
return portal.bridge.Bot
|
return portal.bridge.Bot
|
||||||
}
|
}
|
||||||
|
|
||||||
func (portal *Portal) SetReply(content *event.MessageEventContent, info whatsapp.ContextInfo) {
|
func (portal *Portal) SetReply(content *event.MessageEventContent, msgID types.GroupMeID) {
|
||||||
if len(info.QuotedMessageID) == 0 {
|
if len(msgID) == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
message := portal.bridge.DB.Message.GetByJID(portal.Key, info.QuotedMessageID)
|
message := portal.bridge.DB.Message.GetByJID(portal.Key, msgID)
|
||||||
if message != nil {
|
if message != nil {
|
||||||
evt, err := portal.MainIntent().GetEvent(portal.MXID, message.MXID)
|
evt, err := portal.MainIntent().GetEvent(portal.MXID, message.MXID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -1394,6 +1394,15 @@ func (portal *Portal) handleAttachment(intent *appservice.IntentAPI, attachment
|
|||||||
}
|
}
|
||||||
|
|
||||||
return content, false, nil
|
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:
|
default:
|
||||||
portal.log.Warnln("Unable to handle groupme attachment type", attachment.Type)
|
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)
|
return nil, true, fmt.Errorf("Unable to handle groupme attachment type %s", attachment.Type)
|
||||||
|
Loading…
Reference in New Issue
Block a user