|
@ -3,6 +3,7 @@ package plugin |
|
|
import ( |
|
|
import ( |
|
|
log "github.com/Sirupsen/logrus" |
|
|
log "github.com/Sirupsen/logrus" |
|
|
"github.com/matrix-org/go-neb/matrix" |
|
|
"github.com/matrix-org/go-neb/matrix" |
|
|
|
|
|
"github.com/matrix-org/go-neb/metrics" |
|
|
"github.com/mattn/go-shellwords" |
|
|
"github.com/mattn/go-shellwords" |
|
|
"regexp" |
|
|
"regexp" |
|
|
"strings" |
|
|
"strings" |
|
@ -71,6 +72,7 @@ func runCommandForPlugin(plugin Plugin, event *matrix.Event, arguments []string) |
|
|
"user_id": event.Sender, |
|
|
"user_id": event.Sender, |
|
|
"command": bestMatch.Path, |
|
|
"command": bestMatch.Path, |
|
|
}).Info("Executing command") |
|
|
}).Info("Executing command") |
|
|
|
|
|
metrics.IncIncomingCommand() |
|
|
content, err := bestMatch.Command(event.RoomID, event.Sender, cmdArgs) |
|
|
content, err := bestMatch.Command(event.RoomID, event.Sender, cmdArgs) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
if content != nil { |
|
|
if content != nil { |
|
@ -82,7 +84,10 @@ func runCommandForPlugin(plugin Plugin, event *matrix.Event, arguments []string) |
|
|
"args": cmdArgs, |
|
|
"args": cmdArgs, |
|
|
}).Warn("Command returned both error and content.") |
|
|
}).Warn("Command returned both error and content.") |
|
|
} |
|
|
} |
|
|
|
|
|
metrics.IncErrorCommand() |
|
|
content = matrix.TextMessage{"m.notice", err.Error()} |
|
|
content = matrix.TextMessage{"m.notice", err.Error()} |
|
|
|
|
|
} else { |
|
|
|
|
|
metrics.IncSuccessCommand() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return content |
|
|
return content |
|
|