about summary refs log tree commit diff
path: root/src/petthecord/bot.py
blob: 59827f282e503f5a8b0bbff1ac76b94effa35ce6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from logging import getLogger

from discord import app_commands, Interaction, User
from discord.ext import commands


class PetTheCordCog(commands.Cog):
    def __init__(self, origin: str = "https://ptc.pwn3t.ru") -> None:
        self._origin = origin
        super().__init__()

        self._logger = getLogger(__name__)

    @app_commands.allowed_installs(users=True)
    @app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True)
    @app_commands.command(
        name="petpet",
        description="Pet 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:
        self._logger.info(f"Petting {user.id} for {interaction.user.id}")
        await interaction.response.send_message(f"{self._origin}/{user.id}.{r}.gif")