Message Parser Implementation¶
Parser implementations for disnake message types.
Classes¶
- class disnake_compass.impl.parser.message.PartialMessageParser(int_parser=NOTHING, *, channel=None)[source]¶
Bases:
Parser[PartialMessage]Parser type with support for partial messages.
- Parameters:
Attributes¶
Methods¶
- await dumps(argument, /)[source]¶
Dump a partial message into a string.
This uses the underlying
int_parser.- Parameters:
argument (
PartialMessage) – The value that is to be dumped.
- await loads(argument, /)[source]¶
Load a partial message from a string.
This uses the underlying
int_parser.- Parameters:
argument (
str) – The value that is to be loaded into a partial message.- Raises:
RuntimeError –
channelwas not set, and no channel could be obtained from thesource.
- class disnake_compass.impl.parser.message.MessageParser(int_parser=NOTHING, *, allow_api_requests=True)[source]¶
-
Asynchronous parser type with support for messages.
Warning
This parser can make API requests.
- Parameters:
Attributes¶
Methods¶
- await dumps(argument, /)[source]¶
Dump a message into a string.
This uses the underlying
int_parser.- Parameters:
argument (
Message) – The value that is to be dumped.
- await loads(argument, /)[source]¶
Load a message from a string.
This uses the underlying
int_parser.This method first tries to get the message from cache. If this fails, it will try to fetch the message instead.
Warning
This method can make API requests.
- Parameters:
argument (
str) – The value that is to be loaded into a message.- Raises:
LookupError – A message with the id stored in the
argumentcould not be found.