Total Complexity | 2 |
Total Lines | 34 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | # Copyright Pincer 2021-Present |
||
2 | # Full MIT License can be found in `LICENSE` at the project root. |
||
3 | |||
4 | """sent when a guild's voice server is updated""" |
||
5 | |||
6 | from ..core.dispatch import GatewayDispatch |
||
7 | from ..objects.events.voice import VoiceServerUpdateEvent |
||
8 | from ..utils.conversion import construct_client_dict |
||
9 | from ..utils.types import Coro |
||
10 | |||
11 | |||
12 | async def voice_server_update_middleware(self, payload: GatewayDispatch): |
||
13 | """|coro| |
||
14 | |||
15 | Middleware for ``on_voice_server_update`` event. |
||
16 | |||
17 | Parameters |
||
18 | ---------- |
||
19 | payload : :class:`GatewayDispatch` |
||
20 | The data received from the voice server update event. |
||
21 | |||
22 | Returns |
||
23 | ------- |
||
24 | Tuple[:class:`str`, List[:class:`~pincer.objects.events.voice.VoiceServerUpdateEvent`]] |
||
25 | ``on_voice_server_update`` and a ``VoiceServerUpdateEvent`` |
||
26 | """ |
||
27 | return "on_voice_server_update", [ |
||
28 | VoiceServerUpdateEvent.from_dict(construct_client_dict(self, payload.data)) |
||
29 | ] |
||
30 | |||
31 | |||
32 | def export() -> Coro: |
||
|
|||
33 | return voice_server_update_middleware |
||
34 |