Total Complexity | 2 |
Total Lines | 49 |
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 | """|coro| |
||
15 | |||
16 | Middleware for ``on_message_reaction_remove_emoji`` event. |
||
17 | |||
18 | Parameters |
||
19 | ---------- |
||
20 | self : :class:`Client` |
||
21 | The current client/bot. |
||
22 | |||
23 | payload : :class:`GatewayDispatch` |
||
24 | The data received from the message reaction remove emoji event. |
||
25 | |||
26 | |||
27 | Returns |
||
28 | ------- |
||
29 | Tuple[:class:`str`, List[:class:`~pincer.objects.events.message.MessageReactionRemoveEmojiEvent`]] |
||
|
|||
30 | ``on_message_reaction_remove_emoji`` and an ``MessageReactionRemoveEmojiEvent`` |
||
31 | """ |
||
32 | |||
33 | return "on_message_reaction_remove_emoji", [ |
||
34 | MessageReactionRemoveEmojiEvent.from_dict( |
||
35 | construct_client_dict( |
||
36 | self, |
||
37 | { |
||
38 | "emoji": Emoji.from_dict( |
||
39 | construct_client_dict(self, payload.data.pop("emoji")) |
||
40 | ), |
||
41 | **payload.data |
||
42 | } |
||
43 | )) |
||
44 | ] |
||
45 | |||
46 | |||
47 | def export(): |
||
48 | return message_reaction_remove_emoji_middleware |
||
49 |
This check looks for lines that are too long. You can specify the maximum line length.