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(client, data, guild_id) ⇒ Member

Returns a new instance of Member.



319
320
321
322
323
324
325
# File 'lib/discorb/channel/thread.rb', line 319

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

Instance Attribute Details

#joined_atObject (readonly)

Returns the value of attribute joined_at.



317
318
319
# File 'lib/discorb/channel/thread.rb', line 317

def joined_at
  @joined_at
end

Instance Method Details

#idObject



335
336
337
# File 'lib/discorb/channel/thread.rb', line 335

def id
  @user_id
end

#inspectObject



343
344
345
# File 'lib/discorb/channel/thread.rb', line 343

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

#memberObject



331
332
333
# File 'lib/discorb/channel/thread.rb', line 331

def member
  @client.guilds[@guild_id].members[@user_id]
end

#threadObject



327
328
329
# File 'lib/discorb/channel/thread.rb', line 327

def thread
  @client.channels[@thread_id]
end

#userObject



339
340
341
# File 'lib/discorb/channel/thread.rb', line 339

def user
  @client.users[@user_id]
end