added safety for carriers name (only allow those in the list in case someone has the funny idea of ignoring the autocomplete. No fingers pointed, of course. Light.

This commit is contained in:
TanguyPcFixe 2026-07-04 21:39:47 +02:00
parent 6fdcba7489
commit 9ff9dde701

View File

@ -234,8 +234,15 @@ class IdaCogs(commands.Cog):
async def setCarrierState(self, ctx, carrier, state): async def setCarrierState(self, ctx, carrier, state):
response = await helpers.getFromSheet(self.session, self.gsheetToken, "carrier") response = await helpers.getFromSheet(self.session, self.gsheetToken, "carrier")
await ctx.defer()
#transforms the response into a dict (carrier : state) we can use #transforms the response into a dict (carrier : state) we can use
carrierState = await helpers.parseCarrierState(response) carrierState = await helpers.parseCarrierState(response)
if carrier not in carrierState.keys():
await ctx.followup.send(f"The specified carrier {carrier} is not in the allowed list! Quitting!")
return 0
author = str(ctx.author) author = str(ctx.author)
carrierState[carrier] = state carrierState[carrier] = state
@ -244,7 +251,7 @@ class IdaCogs(commands.Cog):
#print(rawState) #print(rawState)
await ctx.defer()
i = 1 i = 1
text = "Current Carrier State : \n" text = "Current Carrier State : \n"