Emoji Parser Implementation

Parser implementations for disnake emoji types.

Classes

class disnake_compass.impl.parser.emoji.PartialEmojiParser(int_parser=NOTHING)[source]

Bases: Parser[PartialEmoji]

Parser type with support for partial emoji.

Parameters:

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

Attributes

int_parser: IntParser

The IntParser to use internally for this parser.

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

Methods

await dumps(argument, /)[source]

Dump a partial emoji into a string.

This uses the underlying int_parser.

Parameters:

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

await loads(argument, /)[source]

Load a partial emoji from a string.

This uses the underlying int_parser.

Parameters:

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

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

Bases: Parser[Emoji]

Synchronous parser type with support for emoji.

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 emoji parser will also return compressed results.

Methods

await dumps(argument, /)[source]

Dump an emoji into a string.

This uses the underlying int_parser.

Parameters:

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

await loads(argument, /)[source]

Load an emoji from a string.

This uses the underlying int_parser.

Parameters:

argument (str) – The value that is to be loaded into an emoji.

Raises:

LookupError – An emoji with the id stored in the argument could not be found.

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

Bases: Parser[Sticker]

Synchronous parser type with support for stickers.

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 emoji parser will also return compressed results.

Methods

await dumps(argument, /)[source]

Dump a sticker into a string.

This uses the underlying int_parser.

Parameters:

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

await loads(argument, /)[source]

Load a sticker from a string.

This uses the underlying int_parser.

Parameters:

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

Raises:

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