Class: Discordrb::Emoji

Inherits:
Object
  • Object
show all
Includes:
IDObject
Defined in:
lib/discordrb/data.rb

Overview

Server emoji

Instance Attribute Summary collapse

Attributes included from IDObject

#id

Instance Method Summary collapse

Methods included from IDObject

#==, #creation_time

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

#nameString (readonly)



1799
1800
1801
# File 'lib/discordrb/data.rb', line 1799

def name
  @name
end

#rolesArray<Role> (readonly)



1805
1806
1807
# File 'lib/discordrb/data.rb', line 1805

def roles
  @roles
end

#serverServer (readonly)



1802
1803
1804
# File 'lib/discordrb/data.rb', line 1802

def server
  @server
end

Instance Method Details

#icon_urlString



1827
1828
1829
# File 'lib/discordrb/data.rb', line 1827

def icon_url
  API.emoji_icon_url(@id)
end

#inspectObject

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

#mentionString Also known as: use, to_s



1819
1820
1821
# File 'lib/discordrb/data.rb', line 1819

def mention
  "<:#{@name}:#{@id}>"
end