Class: Discordrb::GlobalEmoji
- Inherits:
-
Object
- Object
- Discordrb::GlobalEmoji
- Includes:
- IDObject
- Defined in:
- lib/discordrb/data.rb
Overview
Emoji that is not tailored to a server
Instance Attribute Summary collapse
-
#name ⇒ String
readonly
The emoji name.
-
#role_associations ⇒ Hash<Integer => Array<Role>>
readonly
Roles this emoji is active for in every server.
Attributes included from IDObject
Instance Method Summary collapse
-
#icon_url ⇒ String
The icon URL of the emoji.
-
#initialize(data, bot) ⇒ GlobalEmoji
constructor
A new instance of GlobalEmoji.
-
#inspect ⇒ Object
The inspect method is overwritten to give more useful output.
-
#mention ⇒ String
(also: #use, #to_s)
The layout to mention it (or have it used) in a message.
-
#to_reaction ⇒ String
The layout to use this emoji in a reaction.
Methods included from IDObject
#==, #creation_time, synthesise
Constructor Details
#initialize(data, bot) ⇒ GlobalEmoji
Returns a new instance of GlobalEmoji.
2057 2058 2059 2060 2061 2062 2063 2064 2065 |
# File 'lib/discordrb/data.rb', line 2057 def initialize(data, bot) @bot = bot @roles = nil @name = data.name @id = data.id @role_associations = Hash.new([]) @role_associations[data.server.id] = data.roles end |
Instance Attribute Details
#name ⇒ String (readonly)
Returns the emoji name.
2052 2053 2054 |
# File 'lib/discordrb/data.rb', line 2052 def name @name end |
Instance Method Details
#icon_url ⇒ String
Returns the icon URL of the emoji.
2081 2082 2083 |
# File 'lib/discordrb/data.rb', line 2081 def icon_url API.emoji_icon_url(@id) end |
#inspect ⇒ Object
The inspect method is overwritten to give more useful output
2086 2087 2088 |
# File 'lib/discordrb/data.rb', line 2086 def inspect "<GlobalEmoji name=#{@name} id=#{@id}>" end |
#mention ⇒ String Also known as: use, to_s
Returns the layout to mention it (or have it used) in a message.
2068 2069 2070 |
# File 'lib/discordrb/data.rb', line 2068 def mention "<:#{@name}:#{@id}>" end |
#to_reaction ⇒ String
Returns the layout to use this emoji in a reaction.
2076 2077 2078 |
# File 'lib/discordrb/data.rb', line 2076 def to_reaction "#{@name}:#{@id}" end |