Class: KHL::HTTP::GuildEmoji

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

Overview

服务器表情相关接口 developer.kaiheila.cn/doc/http/guild-emoji

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, emoji, options = {}) ⇒ KHL::HTTP::Response

创建服务器表情

Parameters:

  • guild_id (String)

    服务器 ID

  • emoji (IO)

    表情文件。必须为 PNG 类型,大小不能超过 256 KB

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

    可选参数

Options Hash (options):

  • :name (String)

    表情名。长度限制 2-32 字符,如果不写,则为随机字符串

Returns:



26
27
28
# File 'lib/khl/http/guild_emoji.rb', line 26

def create(guild_id, emoji, options = {})
  post_file(options.merge(content_type: "multipart/form-data", guild_id: guild_id, emoji: emoji))
end

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

删除服务器表情

Parameters:

  • id (String)

    表情 ID

Returns:



41
42
43
# File 'lib/khl/http/guild_emoji.rb', line 41

def delete(id)
  post(id: 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)

    每页数据数量

Returns:



16
17
18
# File 'lib/khl/http/guild_emoji.rb', line 16

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

#update(name, id) ⇒ KHL::HTTP::Response

更新服务器表情

Parameters:

  • name (String)

    表情名。长度限制 2-32 字符,如果不写,则为随机字符串

  • id (String)

    表情 ID

Returns:



34
35
36
# File 'lib/khl/http/guild_emoji.rb', line 34

def update(name, id)
  post(name: name, id: id)
end