diff --git a/action_respond.go b/action_respond.go index 2f610dd..0e36b66 100644 --- a/action_respond.go +++ b/action_respond.go @@ -21,14 +21,26 @@ func init() { } } + ircMessage := &irc.Message{ + Command: "PRIVMSG", + Params: []string{ + m.Params[0], + msg, + }, + } + + if r.RespondAsReply != nil && *r.RespondAsReply { + id, ok := m.GetTag("id") + if ok { + if ircMessage.Tags == nil { + ircMessage.Tags = make(irc.Tags) + } + ircMessage.Tags["reply-parent-msg-id"] = irc.TagValue(id) + } + } + return errors.Wrap( - c.WriteMessage(&irc.Message{ - Command: "PRIVMSG", - Params: []string{ - m.Params[0], - msg, - }, - }), + c.WriteMessage(ircMessage), "sending response", ) }) diff --git a/rule.go b/rule.go index 10428be..ec98af6 100644 --- a/rule.go +++ b/rule.go @@ -305,6 +305,7 @@ type ruleAction struct { RawMessage *string `json:"raw_message" yaml:"raw_message"` Respond *string `json:"respond" yaml:"respond"` + RespondAsReply *bool `json:"respond_as_reply" yaml:"respond_as_reply"` RespondFallback *string `json:"respond_fallback" yaml:"respond_fallback"` Timeout *time.Duration `json:"timeout" yaml:"timeout"` diff --git a/wiki/Home.md b/wiki/Home.md index 5351ff8..dc79c3b 100644 --- a/wiki/Home.md +++ b/wiki/Home.md @@ -62,6 +62,7 @@ rules: # See below for examples # Send responding message to the channel the original message was received in - respond: 'Hello chatter' # String, applies templating + respond_as_reply: true # Boolean, optional, use Twitch-Reply feature in respond respond_fallback: 'Oh noes' # String, text to send if the template function causes # an error, applies templating (default: unset)