summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--README.md3
-rw-r--r--src/petthecord/bot.py29
2 files changed, 31 insertions, 1 deletions
diff --git a/README.md b/README.md
index 0fb7048..dd72cda 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,6 @@
+# FOR PEOPLE WHO JUST WANNA USE IT
+Click [there](https://discord.com/oauth2/authorize?client_id=1280933495845290005) and use the `/petpet` command
+
 PetTheCord
 --
 This is a Web API for petting any user you know which has avatar
diff --git a/src/petthecord/bot.py b/src/petthecord/bot.py
index de1277b..0725943 100644
--- a/src/petthecord/bot.py
+++ b/src/petthecord/bot.py
@@ -1,10 +1,34 @@
 from aiohttp.web import AppRunner, TCPSite
-from discord import Intents
+from discord import app_commands, Interaction, Intents, User
 from discord.ext import commands
 
 from .server import Server
 
 
+class PatTheCordCog(commands.Cog):
+    def __init__(self, client: commands.Bot) -> None:
+        self.client = client
+
+    @app_commands.allowed_installs(users=True)
+    @app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True)
+    @app_commands.command(
+        name="petpet",
+        description="Pat some user"
+    )
+    @app_commands.describe(
+        user="User to pet",
+        r="Some random stuff, set it if avatar is not up to date"
+    )
+    async def petthecord(
+        self,
+        interaction: Interaction,
+
+        user: User,
+        r: str = ""
+    ) -> None:
+        await interaction.response.send_message(f"https://ptc.nakidai.ru/{user.id}.{r}.gif")
+
+
 class Bot(commands.Bot):
     def __init__(self, host: str = "127.0.0.1", port: int = 8080) -> None:
         super().__init__(
@@ -15,6 +39,9 @@ class Bot(commands.Bot):
         self._port = port
 
     async def on_ready(self) -> None:
+        await self.add_cog(PatTheCordCog(self))
+        await self.tree.sync()
+
         runner = AppRunner(Server(self))
         await runner.setup()
         site = TCPSite(runner, self._host, self._port)