command
command copied to clipboard
Update CONTRIBUTING.md to provide a more involved example of creating a command
How do you create your own slash command? How do you get the slash command to do more than just open a new tab which is what is shown in the example given in the documentation here.
I would like to create a /google command that would search the web with google and get the url and title of the search result the user selected and insert it into the textarea.
Hi! Thanks for the feedback. I will work to improve the documentation with a more full-fledged example. In the meantime, here are some good places to start:
- Check out the implementation for the /giphy command here. Probably the biggest thing to see there is how we use the
Containercomponent (source here) to contain the search. This adds in all of the default UI you see in/giphy,/spotify,/emoji. - Check out the
Searchcomponent here. For the simplest implementation, you can use theSearch.Widgetcomponent, which requires thepropsspecified here. If you'd like to do something a little more involved, you can look to Emoji usesSearch.Inputand then does a custom rendering.
If you'd like to dive in, I can make myself available here to answer any questions you have getting set up!