|
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
|
|
|
|