Total Complexity | 2 |
Total Lines | 40 |
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 bot removes all instances of a given emoji from the reactions of a message""" |
||
5 | |||
6 | from ..core.dispatch import GatewayDispatch |
||
7 | from ..objects import Emoji |
||
8 | from ..objects.events.message import MessageReactionRemoveEmojiEvent |
||
9 | from ..utils.conversion import construct_client_dict |
||
10 | |||
11 | |||
12 | async def message_reaction_remove_emoji_middleware(self, |
||
13 | payload: GatewayDispatch): |
||
14 | """ |
||
15 | Middleware for ``on_message_reaction_remove_emoji``, |
||
16 | creates a object for the message reaction emoji that is removed |
||
17 | |||
18 | :param self: |
||
19 | The current client. |
||
20 | |||
21 | :param payload: |
||
22 | The data received from the message reaction remove event. |
||
23 | """ |
||
24 | return "on_message_reaction_remove_emoji", [ |
||
25 | MessageReactionRemoveEmojiEvent.from_dict( |
||
26 | construct_client_dict( |
||
27 | self, |
||
28 | { |
||
29 | "emoji": Emoji.from_dict( |
||
30 | construct_client_dict(self, payload.data.pop("emoji")) |
||
31 | ), |
||
32 | **payload.data |
||
33 | } |
||
34 | )) |
||
35 | ] |
||
36 | |||
37 | |||
38 | def export(): |
||
|
|||
39 | return message_reaction_remove_emoji_middleware |
||
40 |