LIPDProductionsInc / Redwood_Automation

Bot for the City of Redwood
https://discord.gg/Kf9T6h2
1 stars 0 forks source link

Random Embed Bug #1

Open LIPDProductionsInc opened 1 year ago

LIPDProductionsInc commented 1 year ago

Error:

Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.9/site-packages/discord/app_commands/commands.py", line 861, in _do_call
    return await self._callback(self.binding, interaction, **params)  # type: ignore
  File "/home/pi/Documents/Redwood_Automation/cogs/redwood-automation-emergency.py", line 118, in issue
    await channel.send(embed=embed)
UnboundLocalError: local variable 'embed' referenced before assignment

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.9/site-packages/discord/ext/commands/hybrid.py", line 438, in _invoke_with_namespace
    value = await self._do_call(ctx, ctx.kwargs)  # type: ignore
  File "/home/pi/.local/lib/python3.9/site-packages/discord/app_commands/commands.py", line 880, in _do_call
    raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command 'issue' raised an exception: UnboundLocalError: local variable 'embed' referenced before assignment

Command Error Occurred On:

EAS Issued Command

Role Error Occurred On:

Mayor

Able to Re-Produce?

No

LIPDProductionsInc commented 1 year ago

@ThePugi Any idea? Lol

ThePugi commented 1 year ago

@ThePugi Any idea? Lol

Likely that the "Level", for some reason, did not get caught by the if-elif block checks. I'd suspect that to be the root cause

LIPDProductionsInc commented 1 year ago

Alright. I can throw in a quick error catching

LIPDProductionsInc commented 1 year ago

Error catch triggered with "Major Weather Event" level. Fix was pushed earlier

LIPDProductionsInc commented 1 year ago

Above was fixed in https://github.com/LIPDProductionsInc/Redwood_Automation/commit/f59d8672518a7b928e0fc73dbc1ccc8dcbcda98f

LIPDProductionsInc commented 1 year ago

@ThePugi I think this bug is squashed now