Backend¶
discord_http.backend module¶
- class discord_http.backend.DiscordHTTP(*, client)¶
Bases:
Quart
- Parameters:
client (Client)
- error_messages(ctx, e) MessageResponse | None ¶
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
- Return type:
- Returns:
The message response provided by the library error handler
- async index_ping() tuple[dict, int] | dict ¶
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, *, status=200, sort_keys=False, indent=None) Response ¶
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
- Return type:
Response
- Returns:
The response object