Class: KHL::HTTP::DirectMessage
- Defined in:
- lib/khl/http/direct_message.rb
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(content, options = {}) ⇒ KHL::HTTP::Response
发送私信聊天消息.
-
#delete(options = {}) ⇒ KHL::HTTP::Response
删除私信聊天消息.
-
#delete_reaction(msg_id, emoji, options = {}) ⇒ KHL::HTTP::Response
删除消息的某个回应.
-
#list(options = {}) ⇒ KHL::HTTP::Response
获取私信聊天消息列表.
-
#reaction_list(msg_id, options = {}) ⇒ KHL::HTTP::Response
获取频道消息某回应的用户列表.
-
#update(content, options = {}) ⇒ 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
给某个消息添加回应
70 71 72 |
# File 'lib/khl/http/direct_message.rb', line 70 def add_reaction(msg_id, emoji) post(msg_id: msg_id, emoji: emoji) end |
#create(content, options = {}) ⇒ KHL::HTTP::Response
发送私信聊天消息
33 34 35 |
# File 'lib/khl/http/direct_message.rb', line 33 def create(content, = {}) post(.merge(content: content)) end |
#delete(options = {}) ⇒ KHL::HTTP::Response
Note:
只能删除自己的消息
删除私信聊天消息
53 54 55 |
# File 'lib/khl/http/direct_message.rb', line 53 def delete( = {}) post() end |
#delete_reaction(msg_id, emoji, options = {}) ⇒ KHL::HTTP::Response
删除消息的某个回应
80 81 82 |
# File 'lib/khl/http/direct_message.rb', line 80 def delete_reaction(msg_id, emoji, = {}) post(.merge(msg_id: msg_id, emoji: emoji)) end |
#list(options = {}) ⇒ KHL::HTTP::Response
Note:
此接口非标准分页,需要根据参考消息来查询相邻分页的消息
获取私信聊天消息列表
20 21 22 |
# File 'lib/khl/http/direct_message.rb', line 20 def list( = {}) get() end |
#reaction_list(msg_id, options = {}) ⇒ KHL::HTTP::Response
获取频道消息某回应的用户列表
62 63 64 |
# File 'lib/khl/http/direct_message.rb', line 62 def reaction_list(msg_id, = {}) get(.merge(msg_id: msg_id)) end |
#update(content, options = {}) ⇒ KHL::HTTP::Response
Note:
目前支持消息 type 为 9、10 的修改,即 KMarkdown 和 CardMessage
更新私信聊天消息
44 45 46 |
# File 'lib/khl/http/direct_message.rb', line 44 def update(content, = {}) post(.merge(content: content)) end |