chat_commands_class_based   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 40
dl 0
loc 60
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A Bot.add() 0 7 1
A Bot.say() 0 3 1
A Bot.on_ready() 0 5 1
A Bot.private_say() 0 6 1
A Bot.pincer_embed() 0 19 1
1
from pincer import Client
2
from pincer.commands import command, CommandArg, Description
3
from pincer.objects import Message, InteractionFlags, Embed
4
5
6
class Bot(Client):
7
    @Client.event
8
    async def on_ready(self):
9
        print(
10
            f"Started client on {self.bot}\n"
11
            "Registered commands: " + ", ".join(self.chat_commands)
12
        )
13
14
    @command(description="Say something as the bot!")
15
    async def say(self, message: str):
16
        return message
17
18
    @command(description="Add two numbers!")
19
    async def add(
20
        self,
21
        first: CommandArg[int, Description["The first number"]],
22
        second: CommandArg[int, Description["The second number"]],
23
    ):
24
        return f"The addition of `{first}` and `{second}` is `{first + second}`"
25
26
    @command(guild=1324567890)
27
    async def private_say(
28
        self,
29
        message: CommandArg[str, Description["The content of the message"]],
30
    ):
31
        return Message(message, flags=InteractionFlags.EPHEMERAL)
32
33
    @command(description="How to make embed!")
34
    async def pincer_embed(self):
35
        return (
36
            Embed(
37
                title="Pincer - 0.6.4",
38
                description=(
39
                    "🚀 An asynchronous python API wrapper meant to replace"
40
                    " discord.py\n> Snappy discord api wrapper written "
41
                    "with aiohttp & websockets"
42
                ),
43
            )
44
            .add_field(
45
                name="**Github Repository**",
46
                value="> https://github.com/Pincer-org/Pincer",
47
            )
48
            .set_thumbnail(url="https://pincer.dev/img/icon.png")
49
            .set_image(
50
                url=(
51
                    "https://repository-images.githubusercontent.com"
52
                    "/400871418/045ebf39-7c6e-4c3a-b744-0c3122374203"
53
                )
54
            )
55
        )
56
57
58
if __name__ == "__main__":
59
    Bot("XXXYOURBOTTOKENHEREXXX").run()
60