Class: KHL::HTTP::Channel

Inherits:
Base
  • Object
show all
Defined in:
lib/khl/http/channel.rb

Overview

Constant Summary

Constants inherited from Base

Base::API_VERSION, Base::BASE_URL, Base::END_POINT

Instance Attribute Summary

Attributes inherited from Base

#config

Instance Method Summary collapse

Methods inherited from Base

#get, #initialize, #post, #post_file

Constructor Details

This class inherits a constructor from KHL::HTTP::Base

Instance Method Details

#create(guild_id, name, options = {}) ⇒ KHL::HTTP::Response

创建频道

Parameters:

  • guild_id (String)

    服务器 ID

  • name (String)

    频道名称

  • options (Hash) (defaults to: {})

    可选参数

Options Hash (options):

  • :parent_id (String)

    父分组 ID

  • :type (Integer)

    频道类型,1 文字,2 语音,默认为 1

  • :limit_amount (Integer)

    语音频道人数限制,最大 99

  • :voice_quality (Integer)

    语音音质,默认为 2。1 流畅,2 正常,3 高质量

Returns:



37
38
39
# File 'lib/khl/http/channel.rb', line 37

def create(guild_id, name, options = {})
  post(options.merge(guild_id: guild_id, name: name))
end

#delete(channel_id) ⇒ KHL::HTTP::Response

删除频道

Parameters:

  • channel_id (String)

    频道 ID

Returns:



44
45
46
# File 'lib/khl/http/channel.rb', line 44

def delete(channel_id)
  post(channel_id: channel_id)
end

#list(guild_id, options = {}) ⇒ KHL::HTTP::Response

获取频道列表

Parameters:

  • guild_id (String)

    服务器 ID

  • options (Hash) (defaults to: {})

    可选参数

Options Hash (options):

  • :page (Integer)

    页数

  • :page_size (Integer)

    每页数据数量

  • :type (Integer)

    频道类型,1 为文字,2 为语音,默认为 1

Returns:



17
18
19
# File 'lib/khl/http/channel.rb', line 17

def list(guild_id, options = {})
  get(options.merge(guild_id: guild_id))
end

#move_user(target_id, user_ids) ⇒ KHL::HTTP::Response

Note:

只能在语音频道之间移动,用户也必须在其他语音频道在线才能够移动到目标频道

语音频道之间移动用户

Parameters:

  • target_id (String)

    频道 ID,需要是语音频道

  • user_ids (Array)

    用户 ID 数组

Returns:



53
54
55
# File 'lib/khl/http/channel.rb', line 53

def move_user(target_id, user_ids)
  post(target_id: target_id, user_ids: user_ids)
end

#view(target_id) ⇒ KHL::HTTP::Response

获取频道详情

Parameters:

  • target_id (String)

    频道 ID

Returns:



24
25
26
# File 'lib/khl/http/channel.rb', line 24

def view(target_id)
  get(target_id: target_id)
end