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

react   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 19
dl 0
loc 30
rs 10
c 0
b 0
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A React.on_message() 0 4 2
A React.__init__() 0 2 1
A React.create_reaction() 0 6 1
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