Client Payload

The base class for the payload which is sent to the endpoint when the call is made

Parameters

  • payload: The payload to be converted

Attributes

  • length: The length of the payload arguments

  • endpoint: The route that is being called

  • data: The raw Dict date that was sent

Example usage

# Client.request("get_user_data", user_id=383946213629624322)
@Server.route()
async def get_user_data(self, data: ClientPayload) -> Dict:
    user = self.bot.get_user(data.user_id)
    return user._to_minimal_user_json()

You can directly call keyword arguments sent from a Client as attributes

@Server.route()
async def get_user_data(self, data: ClientPayload) -> Dict:
    user = self.bot.get_user(data["user_id"])
    return user._to_minimal_user_json()

You can also subscribe to the object

Last updated