Backend¶
discord_http.backend module¶
- class discord_http.backend.DiscordHTTP(*, client: Client)[source]¶
Bases:
Quart
- error_messages(ctx: Context, e: Exception) MessageResponse | None [source]¶
Used to return error messages to Discord. By default, it will only cover CheckFailed errors. You can overwrite this function to return your own error messages.
- Parameters:
ctx (Context) – The context of the command
e (Exception) – The exception that was raised
- Returns:
The message response provided by the library error handler
- Return type:
Optional[MessageResponse]
- async index_ping() tuple[dict, int] | dict [source]¶
Used to ping the interaction url, to check if it’s working You can overwrite this function to return your own data as well. Remember that it must return dict
- jsonify(data: dict, *, status: int = 200, sort_keys: bool = False, indent: int | None = None) Response [source]¶
Force Quart to respond with JSON the way you like it
- Parameters:
data (dict) – The data to respond with
status (int) – The status code to respond with
sort_keys (bool) – Whether to sort the keys or not
indent (int | None) – If the JSON should be indented on response
- Returns:
The response object
- Return type:
QuartResponse
- run(host: str, port: int, loop: AbstractEventLoop) None [source]¶
## Do NOT use this function, use start instead