Added /action command
This commit is contained in:
parent
16f3d4bc56
commit
35ee903abb
48
cogs/fun.py
Normal file
48
cogs/fun.py
Normal file
@ -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)
|
@ -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": "підморгує"
|
||||
}
|
||||
}
|
||||
}
|
2
main.py
2
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:
|
||||
|
@ -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
|
||||
requests==2.30.0
|
||||
ujson==5.7.0
|
||||
WaifuPicsPython==0.2.0
|
Loading…
Reference in New Issue
Block a user