Passed
Pull Request — main (#360)
by Yohann
01:35
created

context.Bot.on_ready()   A

Complexity

Conditions 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nop 1
1
from pincer import Client
2
from pincer.commands import command, CommandArg, Description
3
from pincer.objects import Embed, MessageContext
4
5
6
class Bot(Client):
7
    @command(description="Say something as the bot!")
8
    async def say(
9
        self,
10
        ctx: MessageContext,
11
        content: CommandArg[str, Description["The content of the message"]],
12
    ) -> Embed:
13
        # Using the ctx to get the command author
14
        return Embed(description=f"{ctx.author.user.mention} said {content}")
15
16
    @Client.event
17
    async def on_ready(self):
18
        # Our client has successfully started, lets let ourself know that!
19
        print("Logged in as", self.bot)
20
21
    @Client.event
22
    async def on_payload(self, payload):
23
        print(payload)
24
25
26
if __name__ == "__main__":
27
    Bot("ODkxNzM4NTExMzExNTE1NzA4.YVCuNA.5OrfKz5KADVhIlxMgXjSs4aQcMk").run()
28