Browse Source

hype hehe

huy
gsd 2 years ago
parent
commit
b6d3f79940
  1. 21
      other_ext/register.py
  2. 4
      player.py

21
other_ext/register.py

@ -1,8 +1,10 @@
from email import message
import discord
from discord.ext import commands
import os
import asyncio, aiohttp
import traceback
from typing import List
class Extension:
auth_channel = 960796520247091201
@ -106,16 +108,25 @@ class Extension:
print(f"Cannot delete message from auth channel, error: {err}")
return
'''@core.tree.command(name = "synclist", description = "Сихронизировать работяг")
@core.tree.command(name = "synclist", description = "Сихронизировать работяг")
@discord.app_commands.describe()
@discord.app_commands.checks.has_role("Администратор Фактов13")
async def sync_list_not_have_role(interaction: discord.Interaction):
current_members = self.core.get_guild(int(self.core.main_server_id)).members
current_members = [i for i in current_members if i]
current_members:List[discord.Member] = self.core.get_guild(int(self.core.main_server_id)).members
current_members = [str(i.id) for i in current_members if i.get_role(self.default_role) == None]
not_synced = None
async with aiohttp.ClientSession(cookies={"secretkey":os.getenv("BACKEND_SECRETKEY")}) as session:
async with session.post(f"{os.getenv('BACKEND_URL')}/api/discord/sync", ssl=False, payload=current_members) as response:
await response.json()'''
async with session.post(f"{os.getenv('BACKEND_URL')}/api/discord/sync", ssl=False, data=current_members) as response:
not_synced = await response.json()
message = "Текущий список:\n"
for uid in not_synced:
message += f"<@{uid}>\n"
if not not_synced:
message += "пусто..."
return await interaction.followup.send(content=message, ephemeral=True)
async def final_stage(self, user: discord.Member, guild: discord.Guild, reason = ""):
try:

4
player.py

@ -108,9 +108,9 @@ class Player:
message = ""
for d in self.current.get("attached_discords", []):
if d['active'] == 1:
message_head += f"<@{d['discord_id']}> | {utime2human(d['utime'])}"
message_head += f"<@{d['discord_id']}> | {utime2human(d['utime'])}\n"
else:
message += f"<@{d['discord_id']}> | {utime2human(d['utime'])}"
message += f"<@{d['discord_id']}> | {utime2human(d['utime'])}\n"
if message_head:
embed.add_field(name="Привязаный аккаунт Discord:", value=message_head, inline=False)

Loading…
Cancel
Save