mirror of
https://github.com/maubot/maubot.git
synced 2024-10-01 01:06:10 -04:00
Use fallbackless body when matching passive commands
This commit is contained in:
parent
66849dd40d
commit
f7fd012218
@ -162,9 +162,17 @@ func (pc *ParsedCommand) MatchActive(evt *gomatrix.Event) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (pc *ParsedCommand) MatchPassive(evt *gomatrix.Event) bool {
|
func (pc *ParsedCommand) MatchPassive(evt *gomatrix.Event) bool {
|
||||||
matchAgainst, ok := deepGet(evt.Content.Raw, pc.MatchAgainst).(string)
|
matchAgainst := evt.Content.Body
|
||||||
if !ok {
|
switch pc.MatchAgainst {
|
||||||
|
case maubot.MatchAgainstBody:
|
||||||
matchAgainst = evt.Content.Body
|
matchAgainst = evt.Content.Body
|
||||||
|
case "formatted_body":
|
||||||
|
matchAgainst = evt.Content.FormattedBody
|
||||||
|
default:
|
||||||
|
matchAgainstDirect, ok := deepGet(evt.Content.Raw, pc.MatchAgainst).(string)
|
||||||
|
if ok {
|
||||||
|
matchAgainst = matchAgainstDirect
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if pc.MatchesEvent != nil && !maubot.JSONLeftEquals(pc.MatchesEvent, evt) {
|
if pc.MatchesEvent != nil && !maubot.JSONLeftEquals(pc.MatchesEvent, evt) {
|
||||||
|
Loading…
Reference in New Issue
Block a user