Redjumpman / Jumper-Plugins

Python Modules for Discord bot
GNU General Public License v3.0
131 stars 95 forks source link

[Raffle] Better message handling/fetching #252

Closed TheDiscordHistorian closed 3 years ago

aikaterna commented 3 years ago

Fix for

[13:04:32] ERROR    Error in raffle_worker task.                                                                                                                                                                  [red.jumper-plugins.raffle]
╭──────────────────────────────────────────────────────────────────────────────────────────────────── Traceback (most recent call last) ────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ /root/.local/share/Red-DiscordBot/data/candy/cogs/CogManager/cogs/raffle/raffle.py:410 in raffle_teardown                                                                                                                                 │
│ ❱ 410                 msg = await channel.get_message(raffles[str(message_id)]["ID"])                                                                                                                                                     │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
AttributeError: 'TextChannel' object has no attribute 'get_message'

During handling of the above exception, another exception occurred:

╭──────────────────────────────────────────────────────────────────────────────────────────────────── Traceback (most recent call last) ────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ /root/.local/share/Red-DiscordBot/data/candy/cogs/CogManager/cogs/raffle/raffle.py:374 in raffle_worker                                                                                                                                   │
│ ❱ 374                             await self.raffle_teardown(guild, raffles[key]["ID"])                                                                                                                                                   │
│ /root/.local/share/Red-DiscordBot/data/candy/cogs/CogManager/cogs/raffle/raffle.py:413 in raffle_teardown                                                                                                                                 │
│ ❱ 413                     msg = await channel.fetch_message(raffles[str(message_id)]["ID"])                                                                                                                                               │
│ /usr/local/lib/python3.8/site-packages/discord/abc.py:1132 in fetch_message                                                                                                                                                               │
│ ❱ 1132         data = await self._state.http.get_message(channel.id, id)                                                                                                                                                                  │
│ /usr/local/lib/python3.8/site-packages/discord/http.py:248 in request                                                                                                                                                                     │
│ ❱  248                             raise Forbidden(r, data)                                                                                                                                                                               │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Forbidden: 403 Forbidden (error code: 50001): Missing Access