Pincer Middleware Module

Activity Join Request

Note

Not implemented yet.

Activity Join

Note

Not implemented yet.

Activity Spectate

Note

Not implemented yet.

Channel Create

channel_create_middleware

channel_create_middleware(self, payload)

This function is a coroutine.

Middleware for on_channel_creation event.

Parameters

payload (GatewayDispatch) – The data received from the ready event.

Returns

"on_channel_creation" and a channel.

Return type

Tuple[str, List[Channel]]

Error

error_middleware

error_middleware(self, payload)

This function is a coroutine.

Middleware for on_error event.

Parameters

payload (GatewayDispatch) – The data received from the ready event.

Returns

"on_error" and a DiscordError

Return type

Tuple[str, List[DiscordError]]

Guild Create

guild_create_middleware

await guild_create_middleware(self, payload)

This function is a coroutine.

Middleware for on_guild_create,

generate the guild class that was created

Parameters

payload (GatewayDispatch) – The data received from the guild create event

Returns

on_guild_create and a Guild

Return type

Tuple[str, List[Guild]]

Guild Status

Note

Not implemented yet.

Interaction Create

convert_message

interaction_response_handler

await interaction_response_handler(self, command, context, interaction, kwargs)

This function is a coroutine.

Handle any coroutine as a command.

Parameters
  • command (Coro) – The coroutine which will be seen as a command.

  • context (MessageContext) – The context of the command.

  • interaction (Interaction) – The interaction which is linked to the command.

  • **kwargs – The arguments to be passed to the command.

interaction_handler

await interaction_handler(self, interaction, context, command)

This function is a coroutine.

Processes an interaction.

Parameters
  • interaction (Interaction) – The interaction which is linked to the command.

  • context (MessageContext) – The context of the command.

  • command (Coro) – The coroutine which will be seen as a command.

interaction_create_middleware

await interaction_create_middleware(self, payload)

Middleware for on_interaction, which handles command execution.

Parameters

payload (GatewayDispatch) – The data received from the interaction event.

Raises

e – Generic try except on await interaction_handler and if 0 < len(params) < 3

Returns

on_interaction_create and an Interaction

Return type

Tuple[str, List[Interaction]]

Message Create

message_create_middleware

await message_create_middleware(self, payload)

This function is a coroutine.

Middleware for on_message event.

Parameters

payload (pincer.core.dispatch.GatewayDispatch) – The data received from the message creation event.

Returns

on_message and a UserMessage

Return type

Tuple[str, List[UserMessage]]

Message Delete

on_message_delete_middleware

await on_message_delete_middleware(self, payload)

This function is a coroutine. Middleware for on_message_delete event.

Parameters

payload (GatewayDispatch) – The data received from the message delete event

Returns

on_message_delete and a MessageDeleteEvent

Return type

Tuple[str, MessageDeleteEvent]

Message Update

message_update_middleware

await message_update_middleware(self, payload)

This function is a coroutine.

Middleware for on_message_update event,

generate a class for the message that has been updated.

Parameters

payload (GatewayDispatch) – The data received from the message update event event

Returns

on_message_update and a UserMessage

Return type

Tuple[str, List[UserMessage]]

Notification Create

Note

Not implemented yet.

Payload

payload_middleware

await payload_middleware(payload)

Invoked when basically anything is received from gateway.

Parameters

payload (pincer.core.dispatch.GatewayDispatch) – The data received from the ready event.

Returns

on_payload and a payload

Return type

Tuple[str, List[GatewayDispatch]]

Ready

on_ready_middleware

await on_ready_middleware(self, payload)

This function is a coroutine.

Middleware for on_ready event.

Parameters

payload (GatewayDispatch) – The data received from the stage instance create event

Returns

on_ready

Return type

Tuple[str]

Speaking Start

Note

Not implemented yet.

Speaking Stop

Note

Not implemented yet.

Voice Channel Select

Note

Not implemented yet.

Voice Connection Status

Note

Not implemented yet.

Voice Settings Update

Note

Not implemented yet.

Voice State Create

Note

Not implemented yet.

Voice State Delete

Note

Not implemented yet.

Voice State Update

voice_state_update_middleware

await voice_state_update_middleware(self, payload)

This function is a coroutine. Middleware for on_voice_state_update event.

Parameters

payload (GatewayDispatch) – The data received from the voice state update event.

Returns

on_voice_state_update and a VoiceState

Return type

Tuple[str, List[VoiceState]]