Skip to content

[BUG] discrepancies in role list typing #939

@Wizzerinus

Description

@Wizzerinus

Describe the bug.

Typing says the list of roles (member.roles) is a list of integers. String comment says it's a list of Role objects. Closer inspection shows it's a list of snowflakes in string form.

def test(role_id: int, user: Member):
  print(role_id, user.roles)

produces this output:

role_id = 995239284326006934
user.roles = ['995245160545910794', '995239336842903572', '995239284326006934']

part of the code:

class Member(...):
  """
    :ivar List[Role] roles: The list of roles of the member.
  """
  roles: List[int]

List the steps.

  1. get a role snowflake in int form
  2. check whether role in member.roles
  3. always get false

What you expected.

get false only if the role is not on the user

What you saw.

role_id_as_int in member.roles always returns false

What version of the library did you use?

stable

Version specification

4.3.0b2 with two commits fixing get() function

Code of Conduct

  • I agree to follow the contribution requirements.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions