class Discorb::Sticker

Represents a sticker.

Attributes

sticker_format[R]

@!visibility private

sticker_type[R]

@!visibility private

available[R]

@return [Boolean] Whether the sticker is available.

available?[R]

@return [Boolean] Whether the sticker is available.

description[R]

@return [String] The URL of the sticker.

format[R]

@return [:png, :apng, :lottie] The format of the sticker.

guild_id[R]

@return [Discorb::Snowflake] The ID of the guild the sticker is in.

id[R]

@return [Discorb::Snowflake] The ID of the sticker.

name[R]

@return [String] The name of the sticker.

pack_id[R]

@return [Discorb::Sticker] The ID of the sticker pack.

sort_value[R]

@return [Integer] The sort value of the sticker.

tags[R]

@return [Array<String>] The tags of the sticker.

type[R]

@return [:official, :guild] The type of sticker.

user[R]

@return [Discorb::User] The user who created the sticker.

Public Class Methods

new(client, data) click to toggle source

@!visibility private

# File lib/discorb/sticker.rb, line 42
def initialize(client, data)
  @client = client
  _set_data(data)
end

Private Instance Methods

_set_data(data) click to toggle source
# File lib/discorb/sticker.rb, line 135
def _set_data(data)
  @id = Snowflake.new(data[:id])
  @name = data[:name]
  @tags = data[:tags].split(",")
  @type = self.class.sticker_type[data[:type]]
  @format = self.class.sticker_format[data[:format]]
  @description = data[:description]
  @available = data[:available]
  if @type == :official
    @pack_id = Snowflake.new(data[:guild_id])
    @sort_value = data[:sort_value]
  else
    @guild_id = Snowflake.new(data[:guild_id])
    @user = data[:user] && (@client.users[data[:user][:id]] || User.new(@client, data[:user]))
  end
end