From e0830766a4ed2f6687b37d8bf6695aa043f9cac9 Mon Sep 17 00:00:00 2001 From: karel26 <41538366+karel26@users.noreply.github.com> Date: Sun, 26 Jan 2025 20:01:53 +0100 Subject: [PATCH] CHANGES: - Battleground2: Added multiple screenshots (quick and dirty) BUGFIXES: - Battleground2: typo in transaction --- plugins/battleground2/commands.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/plugins/battleground2/commands.py b/plugins/battleground2/commands.py index 25acd573..06ba7288 100644 --- a/plugins/battleground2/commands.py +++ b/plugins/battleground2/commands.py @@ -2,12 +2,12 @@ import psycopg import json +from core import Plugin, utils, Channel, Coalition, Server, get_translation from discord import app_commands from discord.app_commands import Group +from services.bot import DCSServerBot from typing import Optional -from core import Plugin, utils, Channel, Coalition, Server, get_translation -from services.bot import DCSServerBot from .listener import BattlegroundEventListener _ = get_translation(__name__.split('.')[1]) @@ -25,7 +25,12 @@ async def rename(self, conn: psycopg.AsyncConnection, old_name: str, new_name: s @battleground.command(description=_('Push MGRS coordinates with screenshots to DCS Battleground')) @app_commands.guild_only() @utils.app_has_role('DCS') - async def recon(self, interaction: discord.Interaction, name: str, mgrs: str, screenshot1: discord.Attachment, screenshot2: Optional[discord.Attachment], screenshot3: Optional[discord.Attachment], screenshot4: Optional[discord.Attachment], screenshot5: Optional[discord.Attachment], screenshot6: Optional[discord.Attachment], screenshot7: Optional[discord.Attachment], screenshot8: Optional[discord.Attachment], screenshot9: Optional[discord.Attachment], screenshot10: Optional[discord.Attachment]): + async def recon(self, interaction: discord.Interaction, name: str, mgrs: str, screenshot1: discord.Attachment, + screenshot2: Optional[discord.Attachment], screenshot3: Optional[discord.Attachment], + screenshot4: Optional[discord.Attachment], screenshot5: Optional[discord.Attachment], + screenshot6: Optional[discord.Attachment], screenshot7: Optional[discord.Attachment], + screenshot8: Optional[discord.Attachment], screenshot9: Optional[discord.Attachment], + screenshot10: Optional[discord.Attachment]): mgrs = mgrs.replace(' ', '') if len(mgrs) != 15 or not mgrs[:2].isnumeric() or not mgrs[5:].isnumeric(): # noinspection PyUnresolvedReferences @@ -44,7 +49,10 @@ async def recon(self, interaction: discord.Interaction, name: str, mgrs: str, sc else: continue done = True - screenshots = [att.url for att in list(filter(lambda item: item is not None,[screenshot1,screenshot2,screenshot3,screenshot4,screenshot5,screenshot6,screenshot7,screenshot8,screenshot9,screenshot10]))] + screenshots = [att.url for att in list(filter(lambda item: item is not None,[ + screenshot1,screenshot2,screenshot3,screenshot4,screenshot5,screenshot6,screenshot7,screenshot8, + screenshot9,screenshot10 + ]))] author = { "name": interaction.user.name, "icon_url": interaction.user.display_avatar.url