Class: Discordrb::Emoji
- Inherits:
-
Object
- Object
- Discordrb::Emoji
- Includes:
- IDObject
- Defined in:
- lib/discordrb/data.rb
Overview
Server emoji
Instance Attribute Summary collapse
-
#name ⇒ String
readonly
The emoji name.
-
#roles ⇒ Array<Role>
readonly
Roles this emoji is active for.
-
#server ⇒ Server
readonly
The server of this emoji.
Attributes included from IDObject
Instance Method Summary collapse
-
#icon_url ⇒ String
The icon URL of the emoji.
-
#initialize(data, bot, server) ⇒ Emoji
constructor
A new instance of Emoji.
-
#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, server) ⇒ Emoji
1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 |
# File 'lib/discordrb/data.rb', line 1807 def initialize(data, bot, server) @bot = bot @roles = nil @name = data['name'] @server = server @id = data['id'].to_i process_roles(data['roles']) if server end |
Instance Attribute Details
#name ⇒ String (readonly)
1799 1800 1801 |
# File 'lib/discordrb/data.rb', line 1799 def name @name end |
#roles ⇒ Array<Role> (readonly)
1805 1806 1807 |
# File 'lib/discordrb/data.rb', line 1805 def roles @roles end |
#server ⇒ Server (readonly)
1802 1803 1804 |
# File 'lib/discordrb/data.rb', line 1802 def server @server end |
Instance Method Details
#icon_url ⇒ String
1827 1828 1829 |
# File 'lib/discordrb/data.rb', line 1827 def icon_url API.emoji_icon_url(@id) end |
#inspect ⇒ Object
The inspect method is overwritten to give more useful output
1832 1833 1834 |
# File 'lib/discordrb/data.rb', line 1832 def inspect "<Emoji name=#{@name} id=#{@id}>" end |
#mention ⇒ String Also known as: use, to_s
1819 1820 1821 |
# File 'lib/discordrb/data.rb', line 1819 def mention "<:#{@name}:#{@id}>" end |