Class: KHL::HTTP::Message
Overview
Constant Summary
Constants inherited from Base
Base::API_VERSION, Base::BASE_URL, Base::END_POINT
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#add_reaction(msg_id, emoji) ⇒ KHL::HTTP::Response
给某个消息添加回应.
-
#create(target_id, content, options = {}) ⇒ KHL::HTTP::Response
发送频道聊天消息.
-
#delete(msg_id) ⇒ KHL::HTTP::Response
删除频道聊天消息.
-
#delete_reaction(msg_id, emoji, options = {}) ⇒ KHL::HTTP::Response
删除消息的某个回应.
-
#list(target_id, options = {}) ⇒ KHL::HTTP::Response
获取频道聊天消息列表.
-
#reaction_list(msg_id, emoji) ⇒ KHL::HTTP::Response
获取频道消息某回应的用户列表.
-
#update(msg_id, content, options = {}) ⇒ KHL::HTTP::Response
更新频道聊天消息.
-
#view(msg_id) ⇒ KHL::HTTP::Response
获取频道聊天消息详情.
Methods inherited from Base
#get, #initialize, #post, #post_file
Constructor Details
This class inherits a constructor from KHL::HTTP::Base
Instance Method Details
#add_reaction(msg_id, emoji) ⇒ KHL::HTTP::Response
给某个消息添加回应
77 78 79 |
# File 'lib/khl/http/message.rb', line 77 def add_reaction(msg_id, emoji) post(msg_id: msg_id, emoji: emoji) end |
#create(target_id, content, options = {}) ⇒ KHL::HTTP::Response
Note:
此接口与频道相关接口下的 “发送频道聊天消息” 功能相同
发送频道聊天消息
41 42 43 |
# File 'lib/khl/http/message.rb', line 41 def create(target_id, content, = {}) post(.merge(target_id: target_id, content: content)) end |
#delete(msg_id) ⇒ KHL::HTTP::Response
Note:
普通用户只能删除自己的消息,有权限的用户可以删除权限范围内他人的消息
删除频道聊天消息
61 62 63 |
# File 'lib/khl/http/message.rb', line 61 def delete(msg_id) post(msg_id: msg_id) end |
#delete_reaction(msg_id, emoji, options = {}) ⇒ KHL::HTTP::Response
删除消息的某个回应
87 88 89 |
# File 'lib/khl/http/message.rb', line 87 def delete_reaction(msg_id, emoji, = {}) post(.merge(msg_id: msg_id, emoji: emoji)) end |
#list(target_id, options = {}) ⇒ KHL::HTTP::Response
Note:
此接口非标准分页,需要根据参考消息来查询相邻分页的消息
获取频道聊天消息列表
19 20 21 |
# File 'lib/khl/http/message.rb', line 19 def list(target_id, = {}) get(.merge(target_id: target_id)) end |
#reaction_list(msg_id, emoji) ⇒ KHL::HTTP::Response
获取频道消息某回应的用户列表
69 70 71 |
# File 'lib/khl/http/message.rb', line 69 def reaction_list(msg_id, emoji) get(msg_id: msg_id, emoji: emoji) end |
#update(msg_id, content, options = {}) ⇒ KHL::HTTP::Response
Note:
目前支持消息 type 为 9、10 的修改,即 KMarkdown 和 CardMessage
更新频道聊天消息
53 54 55 |
# File 'lib/khl/http/message.rb', line 53 def update(msg_id, content, = {}) post(.merge(msg_id: msg_id, content: content)) end |
#view(msg_id) ⇒ KHL::HTTP::Response
获取频道聊天消息详情
26 27 28 |
# File 'lib/khl/http/message.rb', line 26 def view(msg_id) get(msg_id: msg_id) end |