@@ -2524,7 +2524,7 @@ async def handle_warehouse_uploads(self, message: discord.Message):
25242524
25252525 att = message .attachments [0 ]
25262526 filename = att .filename .lower ()
2527- match = re .match (r'^warehouse_ ([^.]*)\.xlsx?$' , filename )
2527+ match = re .match (r'^warehouse- ([^.]*)\.xlsx?$' , filename )
25282528 if not match :
25292529 coalition = await utils .selection (
25302530 ctx ,
@@ -2540,13 +2540,21 @@ async def handle_warehouse_uploads(self, message: discord.Message):
25402540 elif match .group (1 ).upper () in ['RED' , 'BLUE' ]:
25412541 data = await server .send_to_dcs_sync ({"command" : "getMissionSituation" })
25422542 airports = data .get ('coalitions' , {}).get (match .group (1 ).upper (), {}).get ('airbases' )
2543- else :
2543+ elif len ( match . group ( 1 )) == 4 :
25442544 icao = match .group (1 ).upper ()
2545- airport = next ((x for x in server .current_mission .airbases if x .get ('code' , x . get ( 'type' ) ) == icao ), None )
2545+ airport = next ((x for x in server .current_mission .airbases if x .get ('code' , '' ) == icao ), None )
25462546 if not airport :
25472547 await message .channel .send (_ ("Airport with ICAO {} not found." ).format (icao ))
25482548 return
25492549 airports = [airport ['name' ]]
2550+ else :
2551+ name = utils .slugify (match .group (1 )).casefold ()
2552+ airport = next ((x for x in server .current_mission .airbases
2553+ if utils .slugify (x .get ('name' )).casefold () == name ), None )
2554+ if not airport :
2555+ await message .channel .send (_ ("Airport with name {} not found." ).format (name ))
2556+ return
2557+ airports = [airport ['name' ]]
25502558
25512559 if not await utils .yn_question (
25522560 ctx ,
0 commit comments