Merge pull request #37 from github/add_attachment_support

Add support for "attachment" feature
This commit is contained in:
Misty De Meo 2018-06-26 12:09:01 -07:00 коммит произвёл GitHub
Родитель 5378b87c8a baac38a3e9
Коммит 1002a1a7fd
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -70,6 +70,7 @@ but it is important that `result` be sufficient on its own.
* `image_url`: An image URL to display as the button, will generally take precedence
* `command`: The command to use when the button is clicked
* `image_url`: An image URL to be included with the response
* `attachment`: Optional boolean which hints the recipient to format the message as an attachment, if supported by its protocol. Because this is a hint, it may be ignored by clients. If not specified, it defaults to false.
CRPC may also produce error JSON according to the JSON-RPC spec, consisting of
an object containing an `error` object with a `message` string. This is

Просмотреть файл

@ -56,8 +56,13 @@ module Chatops
params["params"] || {}
end
def jsonrpc_success(message)
jsonrpc_response :result => message.to_s
# `options` supports any of the optional fields documented
# in the [protocol](../../docs/protocol-description.md).
def jsonrpc_success(message, options: {})
response = { :result => message.to_s }
# do not allow options to override message
options.delete(:result)
jsonrpc_response response.merge(options)
end
alias_method :chatop_send, :jsonrpc_success