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.
-
#to_reaction ⇒ String
The layout to use this emoji in a reaction.
Methods included from IDObject
#==, #creation_time, synthesise
Constructor Details
#initialize(data, bot, server) ⇒ Emoji
Returns a new instance of Emoji.
2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 |
# File 'lib/discordrb/data.rb', line 2002 def initialize(data, bot, server) @bot = bot @roles = nil @name = data['name'] @server = server @id = data['id'].nil? ? nil : data['id'].to_i process_roles(data['roles']) if server end |
Instance Attribute Details
#name ⇒ String (readonly)
Returns the emoji name.
1994 1995 1996 |
# File 'lib/discordrb/data.rb', line 1994 def name @name end |
#roles ⇒ Array<Role> (readonly)
Returns roles this emoji is active for.
2000 2001 2002 |
# File 'lib/discordrb/data.rb', line 2000 def roles @roles end |
#server ⇒ Server (readonly)
Returns the server of this emoji.
1997 1998 1999 |
# File 'lib/discordrb/data.rb', line 1997 def server @server end |
Instance Method Details
#icon_url ⇒ String
Returns the icon URL of the emoji.
2027 2028 2029 |
# File 'lib/discordrb/data.rb', line 2027 def icon_url API.emoji_icon_url(@id) end |
#inspect ⇒ Object
The inspect method is overwritten to give more useful output
2032 2033 2034 |
# File 'lib/discordrb/data.rb', line 2032 def inspect "<Emoji 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.
2014 2015 2016 |
# File 'lib/discordrb/data.rb', line 2014 def mention "<:#{@name}:#{@id}>" end |
#to_reaction ⇒ String
Returns the layout to use this emoji in a reaction.
2022 2023 2024 |
# File 'lib/discordrb/data.rb', line 2022 def to_reaction "#{@name}:#{@id}" end |