Skip to content

Commit

Permalink
CHANGES:
Browse files Browse the repository at this point in the history
- Battleground2: Added multiple screenshots (quick and dirty)

BUGFIXES:
- Battleground2: typo in transaction
  • Loading branch information
karel26 committed Jan 26, 2025
1 parent f4b12e8 commit e083076
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions plugins/battleground2/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit e083076

Please sign in to comment.