Class: Discordrb::Emoji
- Inherits:
-
Object
- Object
- Discordrb::Emoji
- Includes:
- IDObject
- Defined in:
- lib/discordrb/data.rb
Overview
Server emoji
Instance Attribute Summary collapse
-
#animated ⇒ true, false
(also: #animated?)
readonly
If the emoji is animated.
-
#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
2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 |
# File 'lib/discordrb/data.rb', line 2704 def initialize(data, bot, server) @bot = bot @roles = nil @name = data['name'] @server = server @id = data['id'].nil? ? nil : data['id'].to_i @animated = data['animated'] process_roles(data['roles']) if server end |
Instance Attribute Details
#animated ⇒ true, false (readonly) Also known as: animated?
2701 2702 2703 |
# File 'lib/discordrb/data.rb', line 2701 def animated @animated end |
#name ⇒ String (readonly)
2692 2693 2694 |
# File 'lib/discordrb/data.rb', line 2692 def name @name end |
#roles ⇒ Array<Role> (readonly)
2698 2699 2700 |
# File 'lib/discordrb/data.rb', line 2698 def roles @roles end |
#server ⇒ Server (readonly)
2695 2696 2697 |
# File 'lib/discordrb/data.rb', line 2695 def server @server end |
Instance Method Details
#icon_url ⇒ String
2730 2731 2732 |
# File 'lib/discordrb/data.rb', line 2730 def icon_url API.emoji_icon_url(id) end |
#inspect ⇒ Object
The inspect method is overwritten to give more useful output
2735 2736 2737 |
# File 'lib/discordrb/data.rb', line 2735 def inspect "<Emoji name=#{name} id=#{id} animated=#{animated}>" end |
#mention ⇒ String Also known as: use, to_s
2717 2718 2719 |
# File 'lib/discordrb/data.rb', line 2717 def mention "<#{'a' if animated}:#{name}:#{id}>" end |
#to_reaction ⇒ String
2725 2726 2727 |
# File 'lib/discordrb/data.rb', line 2725 def to_reaction "#{name}:#{id}" end |