Class: Discorb::ThreadChannel::Member

Inherits:
DiscordModel show all
Defined in:
lib/discorb/channel/thread.rb

Overview

Represents a member in a thread.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from DiscordModel

#==, #eql?

Constructor Details

#initialize(cilent, data) -> Member

Returns a new instance of Member.



270
271
272
273
274
275
# File 'lib/discorb/channel/thread.rb', line 270

def initialize(cilent, data)
  @cilent = cilent
  @thread_id = data[:id]
  @user_id = data[:user_id]
  @joined_at = Time.iso8601(data[:join_timestamp])
end

Instance Attribute Details

#joined_at -> Object (readonly)

Returns the value of attribute joined_at.



268
269
270
# File 'lib/discorb/channel/thread.rb', line 268

def joined_at
  @joined_at
end

Instance Method Details

#id -> Object



285
286
287
# File 'lib/discorb/channel/thread.rb', line 285

def id
  @user_id
end

#inspect -> Object



293
294
295
# File 'lib/discorb/channel/thread.rb', line 293

def inspect
  "#<#{self.class} id=#{@id.inspect}>"
end

#member -> Object



281
282
283
# File 'lib/discorb/channel/thread.rb', line 281

def member
  thread && thread.members[@user_id]
end

#thread -> Object



277
278
279
# File 'lib/discorb/channel/thread.rb', line 277

def thread
  @client.channels[@thread_id]
end

#user -> Object



289
290
291
# File 'lib/discorb/channel/thread.rb', line 289

def user
  @cilent.users[@user_id]
end