diff --git a/cogs/fun.py b/cogs/fun.py new file mode 100644 index 0000000..7ddadfc --- /dev/null +++ b/cogs/fun.py @@ -0,0 +1,48 @@ +import logging + +from discord import ApplicationContext, Embed, User, option, slash_command +from discord.ext import commands +from WaifuPicsPython import WaifuAsync + +from modules.utils import config_get +from modules.utils_sync import config_get_sync, guild_name + +logger = logging.getLogger(__name__) + +wafiu_pics = WaifuAsync() + + +class Fun(commands.Cog): + def __init__(self, client): + self.client = client + + @slash_command( + name="action", + description="Провести над користувачем РП дію", + guild_ids=[config_get_sync("guild")], + ) + @option( + "type", + description="Тип дії, яку хочете провести з користувачем", + choices=config_get_sync("actions").keys(), + ) + @option("user", description="Користувач") + async def action_cmd(self, ctx: ApplicationContext, type: str, user: User): + await ctx.defer() + + action = await config_get("category", "actions", type) + action_verb = await config_get("action", "actions", type) + + image = await wafiu_pics.sfw(action) + + logger.info( + f"User {guild_name(ctx.user)} ({ctx.user.id}) {action_verb} {guild_name(user)} ({user.id}) with image {image}" + ) + + embed = Embed( + description=f"**{guild_name(ctx.user)}** {action_verb} **{guild_name(user)}**", + color=0x2F3136, + ) + embed.set_image(url=image) + + await ctx.respond(embed=embed) diff --git a/config_example.json b/config_example.json index b6da562..2f6525b 100644 --- a/config_example.json +++ b/config_example.json @@ -41,5 +41,39 @@ "bots": {}, "messages": { "welcome": "Вітаємо {mention} на сервері HoloUA! Будь ласка, ознайомся з правилами серверу на каналі {rules}. Сподіваємося, тобі тут сподобається!" + }, + "actions": { + "Вкусити": { + "category": "bite", + "action": "робить кусь" + }, + "Обійняти": { + "category": "hug", + "action": "обіймає" + }, + "Поцілувати": { + "category": "kiss", + "action": "цілує" + }, + "Лизнути": { + "category": "lick", + "action": "лиже" + }, + "Погладити": { + "category": "pat", + "action": "гладить" + }, + "Тикнути": { + "category": "poke", + "action": "тикає в" + }, + "Помахати": { + "category": "wave", + "action": "махає" + }, + "Підморгнути": { + "category": "wink", + "action": "підморгує" + } } } \ No newline at end of file diff --git a/main.py b/main.py index 2217a64..3cac432 100644 --- a/main.py +++ b/main.py @@ -6,6 +6,7 @@ from cogs.admin import Admin from cogs.analytics import Analytics from cogs.custom_channels import CustomChannels from cogs.data import Data +from cogs.fun import Fun from cogs.logger import Logger from modules.client import client from modules.scheduled import scheduler @@ -70,6 +71,7 @@ def main(): client.add_cog(Analytics(client)) client.add_cog(CustomChannels(client)) client.add_cog(Data(client)) + client.add_cog(Fun(client)) client.add_cog(Logger(client)) try: diff --git a/requirements.txt b/requirements.txt index c3bf8cf..fbb1aa1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,6 @@ aiofiles==23.1.0 apscheduler==3.10.1 py-cord[speed]==2.4.1 pymongo==4.3.3 -ujson==5.7.0 \ No newline at end of file +requests==2.30.0 +ujson==5.7.0 +WaifuPicsPython==0.2.0 \ No newline at end of file