Passed
Push — main ( 9599de...d89979 )
by Yohann
01:13
created

react.React.create_reaction()   A

Complexity

Conditions 1

Size

Total Lines 6
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nop 2
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
from __future__ import annotations
2
3
from pincer import Client
4
from typing import TYPE_CHECKING
5
6
if TYPE_CHECKING:
7
    from pincer.objects import UserMessage
8
9
10
class React:
11
12
    def __init__(self, client: Client) -> None:
13
        self.client = client
14
15
    @staticmethod
16
    async def create_reaction(message: UserMessage, reaction: str):
17
        await message._http.put(
18
            f"/channels/{message.channel_id}/messages/{message.id}/reactions/"
19
            f"{reaction}/@me",
20
            None
21
        )
22
23
    @Client.event
24
    async def on_message(self, message: UserMessage):
25
        if 'pincer' in message.content:
26
            await self.create_reaction(message, "🚀")
27
28
29
setup = React
30