Class: KHL::HTTP::Invite

Inherits:
Base
  • Object
show all
Defined in:
lib/khl/http/invite.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(options = {}) ⇒ KHL::HTTP::Response

创建邀请链接

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :guild_id (String)

    服务器 ID

  • :channel_id (String)

    频道 ID

  • :duration (Integer)

    邀请链接有效时长(秒),默认 7 天。 可选值: 0(永不)、1800(0.5 小时)、3600(1 小时)、21600(6 小时)、43200(12小时)、86400(1 天)、604800(7 天)

  • :setting_times (Integer)

    设置的次数,默认-1。可选值:-1(无限制)、1、5、10、25、50、100

Returns:



28
29
30
# File 'lib/khl/http/invite.rb', line 28

def create(options = {})
  post(options)
end

#delete(url_code, options = {}) ⇒ KHL::HTTP::Response

删除邀请链接

Parameters:

  • url_code (String)

    邀请码

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

    可选参数

Options Hash (options):

  • :guild_id (String)

    服务器 ID

  • :channel_id (String)

    频道 ID

Returns:



38
39
40
# File 'lib/khl/http/invite.rb', line 38

def delete(url_code, options = {})
  post(options.merge(url_code: url_code))
end

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

获取邀请列表

Parameters:

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

    可选参数

Options Hash (options):

  • :guild_id (String)

    服务器 ID

  • :channel_id (String)

    频道 ID

  • :page (Integer)

    页数

  • :page_size (Integer)

    每页数据数量

Returns:



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

def list(options = {})
  get(options)
end