class MijDiscord::Data::Emoji

Attributes

animated[R]
name[R]
roles[R]
server[R]

Public Class Methods

new(data, server) click to toggle source
# File lib/mij-discord/data/emoji.rb, line 15
def initialize(data, server)
  @server = server

  @id = data['id'].to_i
  @name = data['name']
  @animated = !!data['animated']

  @roles = []
  if @server && (roles = data['roles'])
    @roles = roles.map {|ro| @server.role(ro) }
  end
end

Public Instance Methods

icon_url(format = nil) click to toggle source
# File lib/mij-discord/data/emoji.rb, line 39
def icon_url(format = nil)
  format = @animated ? :gif : :png if format.nil?
  MijDiscord::Core::API.emoji_icon_url(@id, format)
end
inspect() click to toggle source
# File lib/mij-discord/data/emoji.rb, line 44
def inspect
  MijDiscord.make_inspect(self, :id, :name, :animated)
end
mention() click to toggle source
# File lib/mij-discord/data/emoji.rb, line 28
def mention
  a = @animated ? 'a' : ''
  "<#{a}:#{@name}:#{@id}>"
end
Also aliased as: to_s
reaction() click to toggle source
# File lib/mij-discord/data/emoji.rb, line 35
def reaction
  @id.zero? ? @name : "#{@name}:#{@id}"
end
to_s()
Alias for: mention