class Discorb::UnicodeEmoji
Represents a unicode emoji (default emoji) in discord.
Attributes
name[R]
@return [String] The name of the emoji. (e.g. :grinning:)
skin_tone[R]
@return [Integer] The skin tone of the emoji.
value[R]
@return [String] The unicode value of the emoji. (e.g. U+1F600)
Public Class Methods
new(name, tone: 0)
click to toggle source
@!visibility private
# File lib/discorb/emoji.rb, line 193 def initialize(name, tone: 0) if EmojiTable::DISCORD_TO_UNICODE.key?(name) @name = name @value = EmojiTable::DISCORD_TO_UNICODE[name] elsif EmojiTable::UNICODE_TO_DISCORD.key?(name) @name = EmojiTable::UNICODE_TO_DISCORD[name][0] @value = name else raise ArgumentError, "No such emoji: #{name}" end if tone > 0 @value += EmojiTable::SKIN_TONES[tone] end end
Also aliased as: []
Public Instance Methods
inspect()
click to toggle source
# File lib/discorb/emoji.rb, line 222 def inspect "#<#{self.class} :#{@name}:>" end
to_s()
click to toggle source
@return [String] The unicode string of the emoji.
# File lib/discorb/emoji.rb, line 209 def to_s @value end
to_uri()
click to toggle source
Format the emoji for URI.
@return [String] the formatted emoji.
# File lib/discorb/emoji.rb, line 218 def to_uri URI.encode_www_form_component(@value) end