Class: Discordrb::Message
- Inherits:
-
Object
- Object
- Discordrb::Message
- Defined in:
- lib/discordrb/data.rb
Instance Attribute Summary collapse
-
#author ⇒ Object
(also: #user)
readonly
Returns the value of attribute author.
-
#channel ⇒ Object
readonly
Returns the value of attribute channel.
-
#content ⇒ Object
(also: #text)
readonly
Returns the value of attribute content.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#mentions ⇒ Object
readonly
Returns the value of attribute mentions.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Instance Method Summary collapse
-
#initialize(data, bot) ⇒ Message
constructor
A new instance of Message.
Constructor Details
#initialize(data, bot) ⇒ Message
Returns a new instance of Message.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/discordrb/data.rb', line 69 def initialize(data, bot) @bot = bot @content = data['content'] @author = User.new(data['author'], bot) @channel = bot.channel(data['channel_id'].to_i) @timestamp = Time.at(data['timestamp'].to_i) @id = data['id'].to_i @mentions = [] data['mentions'].each do |element| @mentions << User.new(element, bot) end end |
Instance Attribute Details
#author ⇒ Object (readonly) Also known as: user
Returns the value of attribute author.
65 66 67 |
# File 'lib/discordrb/data.rb', line 65 def @author end |
#channel ⇒ Object (readonly)
Returns the value of attribute channel.
65 66 67 |
# File 'lib/discordrb/data.rb', line 65 def channel @channel end |
#content ⇒ Object (readonly) Also known as: text
Returns the value of attribute content.
65 66 67 |
# File 'lib/discordrb/data.rb', line 65 def content @content end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
65 66 67 |
# File 'lib/discordrb/data.rb', line 65 def id @id end |
#mentions ⇒ Object (readonly)
Returns the value of attribute mentions.
65 66 67 |
# File 'lib/discordrb/data.rb', line 65 def mentions @mentions end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
65 66 67 |
# File 'lib/discordrb/data.rb', line 65 def @timestamp end |