Class: Discordrb::Team::Member

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

Overview

A member that has been invited to a team.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#roleSymbol (readonly)

Returns the role of this team member.

Returns:

  • (Symbol)

    the role of this team member.



41
42
43
# File 'lib/discordrb/data/team.rb', line 41

def role
  @role
end

#stateInteger (readonly)

Returns the membership state of this team member.

Returns:

  • (Integer)

    the membership state of this team member.



47
48
49
# File 'lib/discordrb/data/team.rb', line 47

def state
  @state
end

#teamTeam (readonly)

Returns the team this member is a part of.

Returns:

  • (Team)

    the team this member is a part of.



44
45
46
# File 'lib/discordrb/data/team.rb', line 44

def team
  @team
end

#userInteger (readonly)

Returns the user associated with this team member.

Returns:

  • (Integer)

    the user associated with this team member.



50
51
52
# File 'lib/discordrb/data/team.rb', line 50

def user
  @user
end

Instance Method Details

#==(other) ⇒ true, false Also known as: eql?

Comparison based off of user ID and team ID.

Returns:

  • (true, false)

    if the two objects are equal.



87
88
89
90
91
92
93
# File 'lib/discordrb/data/team.rb', line 87

def ==(other)
  return false unless other.is_a?(Member)

  return false unless @team == other.team

  Discordrb.id_compare?(other.user.id, @user.id)
end

#admin?true, false

Returns whether this team member is an admin.

Returns:

  • (true, false)

    whether this team member is an admin.



79
80
81
82
83
# File 'lib/discordrb/data/team.rb', line 79

%i[admin developer read_only].each do |role|
  define_method("#{role}?") do
    @role == role
  end
end

#developer?true, false

Returns whether this team member is a developer.

Returns:

  • (true, false)

    whether this team member is a developer.



79
80
81
82
83
# File 'lib/discordrb/data/team.rb', line 79

%i[admin developer read_only].each do |role|
  define_method("#{role}?") do
    @role == role
  end
end

#owner?true, false

Whether this team member is the owner of the team.

Returns:

  • (true, false)


69
70
71
# File 'lib/discordrb/data/team.rb', line 69

def owner?
  @team.owner == self
end

#pending?true, false

Whether this team member has been invited to the team, but hasn't accepted the invite yet.

Returns:

  • (true, false)


63
64
65
# File 'lib/discordrb/data/team.rb', line 63

def pending?
  @state == 1
end

#read_only?true, false

Returns whether this team member is a read only developer.

Returns:

  • (true, false)

    whether this team member is a read only developer.



79
80
81
82
83
# File 'lib/discordrb/data/team.rb', line 79

%i[admin developer read_only].each do |role|
  define_method("#{role}?") do
    @role == role
  end
end