struct Slack::Command
- Slack::Command
- Struct
- Value
- Object
Overview
Models events sent by Slack slash commands. Slack allow for slash commands to optionally encode or declode usernames, channel names, and other data.
To learn more, see the Slack API documentation: Slack Commands API
Included Modules
- JSON::Serializable
- Slack::InitializerMacros
Defined in:
slack/commands/command.crConstant Summary
-
ASSIGNED_TYPES =
[api_app_id : String, channel_id : String, channel_name : String, command : String, enterprise_id : String | ::Nil, enterprise_name : String | ::Nil, response_url : String, team_id : String, team_name : String | ::Nil, text : String, trigger_id : String, user_id : String, user_name : String] of TypeDeclaration
Constructors
- .new(api_app_id : String, channel_id : String, channel_name : String, command : String, response_url : String, team_id : String, text : String, trigger_id : String, user_id : String, user_name : String, enterprise_id : String | Nil = nil, enterprise_name : String | Nil = nil, team_name : String | Nil = nil)
- .new(pull : JSON::PullParser)
Instance Method Summary
- #api_app_id : String
- #api_app_id=(api_app_id : String)
- #channel_id : String
- #channel_id=(channel_id : String)
- #channel_name : String
- #channel_name=(channel_name : String)
- #command : String
- #command=(command : String)
-
#decoded_channels : Array(EncodedTextReference)
Escaped channels may include the channel name and ID with a bar separator:
<@C2147483705|channel-name>
. -
#decoded_usernames : Array(EncodedTextReference)
Escaped usernames in text will often be formatted with the user_id and the username encoded
<@U012ABCDEF|worf>
). - #enterprise_id : String | Nil
- #enterprise_id=(enterprise_id : String | Nil)
- #enterprise_name : String | Nil
- #enterprise_name=(enterprise_name : String | Nil)
-
#plaintext_channels : Array(PlainTextReference)
If an app is configured to not escape channels in text fields, the format channels will be presented as will be @channel, or @channel-with-dashes.
-
#plaintext_usernames : Array(PlainTextReference)
If an app is configured to not escape usernames in text fields, the format usernames will be presented as will be @username, or @user_name for a user with a space in their username.
- #response_url : String
- #response_url=(response_url : String)
- #team_id : String
- #team_id=(team_id : String)
- #team_name : String | Nil
- #team_name=(team_name : String | Nil)
- #text : String
- #text=(text : String)
- #trigger_id : String
- #trigger_id=(trigger_id : String)
- #user_id : String
- #user_id=(user_id : String)
- #user_name : String
- #user_name=(user_name : String)
Constructor Detail
Instance Method Detail
Escaped channels may include the channel name and ID with a bar separator:
<@C2147483705|channel-name>
.
Escaped usernames in text will often be formatted with the user_id and
the username encoded <@U012ABCDEF|worf>
).
Slack is phasing these out, so apps should only rely on the ID, not the user_name + separator, long-term. Those that aren't being phased out are treated as "unreliable" -- meaning they change frequently and are mostly decorators.
More info available at Slack: The One About Usernames
If an app is configured to not escape channels in text fields, the format channels will be presented as will be @channel, or @channel-with-dashes. A space signifies the end of a channel name.
If an app is configured to not escape usernames in text fields, the format usernames will be presented as will be @username, or @user_name for a user with a space in their username. A space signifies the end of a username.