flaree / flare-cogs

Various cogs written for Red-DiscordBot
MIT License
76 stars 69 forks source link

Error in command 'giveaway end'. Check your console or logs for details. #227

Open mon5termatt opened 6 months ago

mon5termatt commented 6 months ago

Describe the bug A clear and concise description of what the bug is.

.giveaway end errors out.

Output of [p]help CogName and [p]debuginfo

.help Giveaways Giveaway Commands Cog Version: 1.3.2 Author: flare ​ Commands: giveaway Manage the giveaway system


.debuginfo

Debug Info for Red:

System Metadata:

CPU Cores: 80 (x86_64) RAM: 335.0GB/503.2GB (67.2%)

OS variables:

OS version: Debian GNU/Linux 11 User: docker Python executable: /data/venv/bin/python Python version: 3.11.9 (64bit) Pip version: 24.0 Red version: 3.5.9 Discord.py version: 2.3.2

Red variables:

Instance name: docker Command line arguments: ['python', '-O', '-m', 'redbot', 'docker', '--co-owner', '829612600059887649', '--dev'] Global prefix(es): '.' Owner(s): 829612600059887649 (aaa3a), 447225019978743820 (mon5termatt) Disabled intents: None Storage type: JSON Data path: /data

traceback

Exception in command 'giveaway end'
Traceback (most recent call last):
  File "/data/cogs/CogManager/cogs/giveaways/giveaways.py", line 142, in draw_winner
    await msg.edit(content="🎉 Giveaway Ended 🎉", embed=embed, view=None)
  File "/data/venv/lib/python3.11/site-packages/discord/message.py", line 983, in edit
    data = await self._state.http.edit_message(self.channel.id, self.id, params=params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/venv/lib/python3.11/site-packages/discord/http.py", line 741, in request
    raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10008): Unknown Message

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/data/venv/lib/python3.11/site-packages/discord/ext/commands/core.py", line 235, in wrapped
    ret = await coro(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/cogs/CogManager/cogs/giveaways/giveaways.py", line 284, in end
    await self.draw_winner(self.giveaways[msgid])
  File "/data/cogs/CogManager/cogs/giveaways/giveaways.py", line 148, in draw_winner
    entrants = [x for x in entrants if x != winner]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/cogs/CogManager/cogs/giveaways/giveaways.py", line 148, in <listcomp>
    entrants = [x for x in entrants if x != winner]
                                            ^^^^^^
NameError: cannot access free variable 'winner' where it is not associated with a value in enclosing scope

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

Traceback (most recent call last):
  File "/data/venv/lib/python3.11/site-packages/discord/ext/commands/bot.py", line 1350, in invoke
    await ctx.command.invoke(ctx)
  File "/data/venv/lib/python3.11/site-packages/redbot/core/commands/commands.py", line 825, in invoke
    await super().invoke(ctx)
  File "/data/venv/lib/python3.11/site-packages/discord/ext/commands/core.py", line 1650, in invoke
    await ctx.invoked_subcommand.invoke(ctx)
  File "/data/venv/lib/python3.11/site-packages/discord/ext/commands/core.py", line 1029, in invoke
    await injected(*ctx.args, **ctx.kwargs)  # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/data/venv/lib/python3.11/site-packages/discord/ext/commands/core.py", line 244, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: cannot access free variable 'winner' where it is not associated with a value in enclosing scope