User Parser Implementation

Parser implementations for disnake user types.

Classes

class disnake_compass.impl.parser.user.UserParser(int_parser=NOTHING, *, allow_api_requests=True)[source]

Bases: Parser[User]

Parser type with support for users.

Warning

This parser can make API requests.

Parameters:
  • int_parser (IntParser) – The IntParser to use internally for this parser.

  • allow_api_requests (bool) – Whether or not to allow this parser to make API requests.

Attributes

allow_api_requests: bool

Whether or not to allow this parser to make API requests.

Parsers will always try getting a result from cache first.

int_parser: IntParser

The IntParser to use internally for this parser.

Since the default integer parser uses base-36 to “compress” numbers, the default guild parser will also return compressed results.

Methods

await dumps(argument, /)[source]

Dump a user into a string.

This uses the underlying int_parser.

Parameters:

argument (User) – The value that is to be dumped.

await loads(argument, /)[source]

Load a user from a string.

This uses the underlying int_parser.

Parameters:

argument (str) – The value that is to be loaded into a user.

Raises:

LookupError – A user with the id stored in the argument could not be found.

class disnake_compass.impl.parser.user.MemberParser(int_parser=NOTHING, *, allow_api_requests=True)[source]

Bases: Parser[Member]

Asynchronous parser type with support for members.

Warning

This parser can make API requests.

Parameters:
  • int_parser (IntParser) – The IntParser to use internally for this parser.

  • allow_api_requests (bool) – Whether or not to allow this parser to make API requests.

Attributes

allow_api_requests: bool

Whether or not to allow this parser to make API requests.

Parsers will always try getting a result from cache first.

int_parser: IntParser

The IntParser to use internally for this parser.

Since the default integer parser uses base-36 to “compress” numbers, the default guild parser will also return compressed results.

Methods

await dumps(argument, /)[source]

Dump a user into a string.

This uses the underlying int_parser.

Parameters:

argument (Member) – The value that is to be dumped.

await loads(argument, /)[source]

Load a member from a string.

This uses the underlying int_parser.

Parameters:

argument (str) – The value that is to be loaded into a member.

Raises:

LookupError – A member with the id stored in the argument could not be found.