Conditions | 1 |
Total Lines | 19 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | # Copyright Pincer 2021-Present |
||
15 | async def notification_create_middleware(self, payload: GatewayDispatch): |
||
16 | """|coro| |
||
17 | |||
18 | Middleware for ``on_notification_create`` event. |
||
19 | |||
20 | Parameters |
||
21 | ---------- |
||
22 | payload : :class:`GatewayDispatch` |
||
23 | The data received from the notification create event. |
||
24 | |||
25 | Returns |
||
26 | ------- |
||
27 | Tuple[:class:`str`, List[:class:`~pincer.objects.events.notification.NotificationCreateEvent`]] |
||
28 | ``on_notification_create`` and a ``NotificationCreateEvent`` |
||
29 | """ |
||
30 | channel_id: int = payload.data.get("channel_id") |
||
31 | payload.data["message"]["channel_id"] = channel_id |
||
32 | return "on_notification_create", [ |
||
33 | NotificationCreateEvent.from_dict(construct_client_dict(self, payload.data)) |
||
34 | ] |
||
39 |