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.
Methods included from IDObject
Constructor Details
#initialize(data, bot) ⇒ GlobalEmoji
Returns a new instance of GlobalEmoji.
1857 1858 1859 1860 1861 1862 1863 1864 1865 |
# File 'lib/discordrb/data.rb', line 1857 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.
1852 1853 1854 |
# File 'lib/discordrb/data.rb', line 1852 def name @name end |
Instance Method Details
#icon_url ⇒ String
Returns the icon URL of the emoji.
1876 1877 1878 |
# File 'lib/discordrb/data.rb', line 1876 def icon_url API.emoji_icon_url(@id) end |
#inspect ⇒ Object
The inspect method is overwritten to give more useful output
1881 1882 1883 |
# File 'lib/discordrb/data.rb', line 1881 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.
1868 1869 1870 |
# File 'lib/discordrb/data.rb', line 1868 def mention "<:#{@name}:#{@id}>" end |