44
55from discord import app_commands
66from discord .app_commands import Group
7+ from typing import Optional
78
89from core import Plugin , utils , Channel , Coalition , Server , get_translation
910from services .bot import DCSServerBot
@@ -24,7 +25,7 @@ async def rename(self, conn: psycopg.AsyncConnection, old_name: str, new_name: s
2425 @battleground .command (description = _ ('Push MGRS coordinates with screenshots to DCS Battleground' ))
2526 @app_commands .guild_only ()
2627 @utils .app_has_role ('DCS' )
27- async def recon (self , interaction : discord .Interaction , name : str , mgrs : str , screenshot : discord .Attachment ):
28+ 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 ] ):
2829 mgrs = mgrs .replace (' ' , '' )
2930 if len (mgrs ) != 15 or not mgrs [:2 ].isnumeric () or not mgrs [5 :].isnumeric ():
3031 # noinspection PyUnresolvedReferences
@@ -43,7 +44,7 @@ async def recon(self, interaction: discord.Interaction, name: str, mgrs: str, sc
4344 else :
4445 continue
4546 done = True
46- screenshots = [att .url for att in [ screenshot ]] # TODO: add multiple ones
47+ screenshots = [att .url for att in list ( filter ( lambda item : item is not None ,[ screenshot1 , screenshot2 , screenshot3 , screenshot4 , screenshot5 , screenshot6 , screenshot7 , screenshot8 , screenshot9 , screenshot10 ]))]
4748 author = {
4849 "name" : interaction .user .name ,
4950 "icon_url" : interaction .user .display_avatar .url
@@ -87,7 +88,7 @@ async def recon(self, interaction: discord.Interaction, name: str, mgrs: str, sc
8788 async def reset (self , interaction : discord .Interaction ,
8889 server : app_commands .Transform [Server , utils .ServerTransformer ]):
8990 async with self .apool .connection () as conn :
90- async with conn .transation ():
91+ async with conn .transaction ():
9192 await conn .execute ("DELETE FROM bg_geometry2 WHERE server_name = %s" , (server .name , ))
9293 await conn .execute ("DELETE FROM bg_missions WHERE server_name = %s" , (server .name ,))
9394 await conn .execute ("DELETE FROM bg_task WHERE server_name = %s" , (server .name ,))
0 commit comments