Class: Discorb::ThreadChannel::Member

Inherits:
DiscordModel show all
Defined in:
lib/discorb/channel.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.



1054
1055
1056
1057
1058
1059
# File 'lib/discorb/channel.rb', line 1054

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.



1052
1053
1054
# File 'lib/discorb/channel.rb', line 1052

def joined_at
  @joined_at
end

Instance Method Details

#id -> Object



1069
1070
1071
# File 'lib/discorb/channel.rb', line 1069

def id
  @user_id
end

#inspect -> Object



1077
1078
1079
# File 'lib/discorb/channel.rb', line 1077

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

#member -> Object



1065
1066
1067
# File 'lib/discorb/channel.rb', line 1065

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

#thread -> Object



1061
1062
1063
# File 'lib/discorb/channel.rb', line 1061

def thread
  @client.channels[@thread_id]
end

#user -> Object



1073
1074
1075
# File 'lib/discorb/channel.rb', line 1073

def user
  @cilent.users[@user_id]
end