from dubious.discord import disc¶
- class dubious.discord.disc.Snowflake(r: str | int)¶
Represents a Discord Snowflake.
dubious.discord.apiimports this. It’s acceptable to usefrom dubious.discord import apiand useapi.Snowflakeinstead ofdisc.Snowflake.
- class dubious.discord.disc.Disc¶
Root class for all Discord objects. Exists in case there’s some functionality to be implemented across every Discord data structure.
- dubious.discord.disc.cast(t_to: type[t_Cast], raw: Any) t_Cast¶
Casts
rawdata of any shape to the given type,t_to.
- class dubious.discord.disc.Http(value)¶
Enum for each potential type of request to make to the Discord API.
- class dubious.discord.disc.t_Ret¶
Represents the type that an
HttpReqwill return upon success.alias of TypeVar(‘t_Ret’)
- class dubious.discord.disc.HttpReq¶
A class that holds information about a request to make to the Discord API.
Subclasses should define within themselves a class for the
queryattribute and/or theformattribute, if either exist, and appropriately set the type hints of either.- query: Disc | None = None¶
An object to give to the request. Acts as a query string in the URL; is given to
requests.request()as theparamskwarg.
- form: Disc | None = None¶
An object to give to the request. Acts as a json string in the request’s body; is given to
requests.request()as thejsonkwarg.
- method: ClassVar[Http]¶
The HTTP method with which to make the request. Given to
requests.request()as themethodargument.
- endpoint: str¶
The URL at which the request should be made. Given to
requests.request()as theurlargument. This field is set dynamically in a subclass’s__post_init__in order to allow for per-guild/per-channel/etc. requests.
- do_with(token: str) t_Ret¶
Perform this Discord API request with
requests.request(). Requires authentication using a bot token - this is usuallydubious.pory.Pory.token.When a rate limit is encountered, wait the response’s given time and retry (by calling recursively).