Open
Description
We want to change the semantics so that commands and interactions are executed synchronously (as opposed to putting it in a queue) by default. It should still be possible to opt into the current asynchronous behavior with something like this:
class MonkeyCommand < Slackathon::Command
async def call
{
response_type: "ephemeral",
attachments: [{
callback_id: "monkey",
text: "Please pick a style",
actions: [{
type: "button",
text: "Click to use :see_no_evil:",
name: "post_in_channel",
value: "#{params[:text]} :see_no_evil:"
}, {
type: "button",
text: "Click to use :hear_no_evil:",
name: "post_in_channel",
value: "#{params[:text]} :hear_no_evil:"
}, {
type: "button",
text: "Click to use :speak_no_evil:",
name: "post_in_channel",
value: "#{params[:text]} :speak_no_evil:"
}]
}]
}
end
async def post_in_channel(value)
{
response_type: "in_channel",
delete_original: true,
text: "<@#{params[:user][:id]}> said #{value}"
}
end
end
The async
class method can store the symbols in an array on the class instance, and dispatch_*
can check whether it should call the method synchronously.
Metadata
Metadata
Assignees
Labels
No labels
Activity