Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chat: support chat.command for sending a command #176

Closed
wants to merge 1 commit into from

Conversation

kalbasit
Copy link

@kalbasit kalbasit commented Aug 3, 2017

The chat.command method allows calling internal and custom commands in a slack team. It's worth to mention that I can't see chat.command in the doc for methods, and I found it being used in wee-slack.

Tested with jpbruinsslot/slack-term#57

@dvdplm
Copy link
Contributor

dvdplm commented Dec 22, 2017

@kalbasit do you mind asking the Slack API support about this? Is it an undocumented feature they'd rather people didn't use or is it simply something they forgot to document? Also a usage example + test would be great so we know if/when it breaks. Thanks!

@james-lawrence
Copy link
Contributor

james-lawrence commented Apr 11, 2018

@kalbasit @dvdplm I'd be willing to accept this in the form of a method that lets you explicity set the mode.

// MsgOptionMode used to set a custom mode, useful for modes like 'chat.command' which exist but
// are not officially supported.
func MsgOptionMode(mode string) MsgOption {
	return func(config *sendConfig) error {
		config.mode = mode
		return nil
	}
}

@dvdplm
Copy link
Contributor

dvdplm commented Apr 11, 2018

@james-lawrence can you elaborate on what the allowed values for mode are? Sounds like we'd want to lock down the allowed values.

@bee-keeper
Copy link

Is there any interest in getting this committed? Happy to take it on if you're willing to merge the feature? I know it's an undocumented API but without we can't write bots which submit commands.

@james-lawrence
Copy link
Contributor

james-lawrence commented Aug 18, 2018

@dvdplm I say we lock down support for official values which we do via the MsgOptions, but there is a usecase here that I've also run into w/ ephemeral messages.

@bee-keeper yes there is interest on my part I have a related PR which also requires some internal changes to SendMessage API.

In particular I think we should consider changing config.mode to config.endpoint and updating the relevant MsgOption. I also believe we should be very clear in the PR that the method is unsupported officially. Then this PR changes to:

// UnsafeMsgOptionEndpoint deliver the message to the specified endpoint.
// NOTE: USE AT YOUR OWN RISK: No issues relating to the use of this Option
// will be supported by the library, it is subject to change without notice that
// may result in compilation errors or runtime behaviour changes.
func MsgOptionEndpoint(endpoint string, update func(url.Values)) MsgOption {
	return func(config *sendConfig) error {
		config.endpoint = endpoint
		update(config.values)
		return nil
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants