summaryrefslogtreecommitdiffstats
path: root/model/client4.go
diff options
context:
space:
mode:
Diffstat (limited to 'model/client4.go')
-rw-r--r--model/client4.go18
1 files changed, 17 insertions, 1 deletions
diff --git a/model/client4.go b/model/client4.go
index 941145043..5703c4143 100644
--- a/model/client4.go
+++ b/model/client4.go
@@ -2816,7 +2816,7 @@ func (c *Client4) ListCommands(teamId string, customOnly bool) ([]*Command, *Res
}
}
-// ExecuteCommand executes a given command.
+// ExecuteCommand executes a given slash command.
func (c *Client4) ExecuteCommand(channelId, command string) (*CommandResponse, *Response) {
commandArgs := &CommandArgs{
ChannelId: channelId,
@@ -2830,6 +2830,22 @@ func (c *Client4) ExecuteCommand(channelId, command string) (*CommandResponse, *
}
}
+// ExecuteCommand executes a given slash command against the specified team
+// Use this when executing slash commands in a DM/GM, since the team id cannot be inferred in that case
+func (c *Client4) ExecuteCommandWithTeam(channelId, teamId, command string) (*CommandResponse, *Response) {
+ commandArgs := &CommandArgs{
+ ChannelId: channelId,
+ TeamId: teamId,
+ Command: command,
+ }
+ if r, err := c.DoApiPost(c.GetCommandsRoute()+"/execute", commandArgs.ToJson()); err != nil {
+ return nil, BuildErrorResponse(r, err)
+ } else {
+ defer closeBody(r)
+ return CommandResponseFromJson(r.Body), BuildResponse(r)
+ }
+}
+
// ListCommands will retrieve a list of commands available in the team.
func (c *Client4) ListAutocompleteCommands(teamId string) ([]*Command, *Response) {
if r, err := c.DoApiGet(c.GetTeamAutoCompleteCommandsRoute(teamId), ""); err != nil {