|
|
@ -5,6 +5,7 @@ import asyncio |
|
|
|
import traceback |
|
|
|
import os |
|
|
|
from exceptions import NotFoundPlayerOnServer |
|
|
|
import aiohttp |
|
|
|
|
|
|
|
class Extension: |
|
|
|
core = None |
|
|
@ -33,6 +34,19 @@ class Extension: |
|
|
|
"🔎":("profile", {"profile":"", "requester_profile":"", "discord_user":None}) |
|
|
|
} |
|
|
|
|
|
|
|
self.reaction_translate = { |
|
|
|
'😘':"ban", |
|
|
|
'🔍':"inspect", |
|
|
|
'🦵':"kick", |
|
|
|
'🔨':"ban30", |
|
|
|
'⚒️':"ban120", |
|
|
|
'📨':"noreason", |
|
|
|
'<:hueglot:713139400028061767>':"author_kick", |
|
|
|
'🔇':"mute", |
|
|
|
'😇':"unban", |
|
|
|
'🔎':'author_inspect' |
|
|
|
} |
|
|
|
|
|
|
|
@core.listen() |
|
|
|
async def on_message(message: discord.Message): |
|
|
|
if message.webhook_id != self.track_webhook_id: |
|
|
@ -111,6 +125,12 @@ class Extension: |
|
|
|
|
|
|
|
print(kwargs) |
|
|
|
|
|
|
|
try: |
|
|
|
report_id = message.embeds[0].color.value |
|
|
|
await self.add_action(report_id, str(payload.emoji)) |
|
|
|
except Exception: |
|
|
|
traceback.print_exc() |
|
|
|
|
|
|
|
try: |
|
|
|
if type(executor) == str: |
|
|
|
result = await self.core.loaded_extensions[executor](**kwargs) |
|
|
@ -129,3 +149,13 @@ class Extension: |
|
|
|
async def null_reason(self, requester): |
|
|
|
self.no_reason[requester] = "no reason" |
|
|
|
return "Следующий бан будет без причины" |
|
|
|
|
|
|
|
async def add_action(self, report_id, emoji): |
|
|
|
if emoji in self.reaction_translate: |
|
|
|
async with aiohttp.ClientSession(cookies={ |
|
|
|
"secretkey":os.getenv("BACKEND_SECRETKEY")}) as session: |
|
|
|
async with session.post(f"{os.getenv('BACKEND_URL')}/api/server/any/report/{report_id}", data=self.reaction_translate[emoji], ssl = False) as response: |
|
|
|
result = await response.text() |
|
|
|
print(f"Action added with id: {result}") |
|
|
|
else: |
|
|
|
print(f"Not found traslate for reaction: {emoji}") |
|
|
|