Skip to content

[BUG] Automatic message fetching in reaction events causes unnecessary 403 errors #1753

@feelixs

Description

@feelixs

Library Version

5.13.2

Describe the Bug

The library is automatically attempting to fetch full message details for every reaction event through ReactionEvents._on_raw_message_reaction_add(), even when the bot code isn't using message data. This causes 403 Forbidden errors in channels where the bot can see reactions but lacks READ_MESSAGE_HISTORY permissions when it tries to fetch an uncached message.

Steps to Reproduce

React to a bot's message in a channel where it doesn't have the READ_MESSAGE_HISTORY permission

Expected Results

Recieve error 403

Minimal Reproducible Code

Traceback

2025-02-03 15:32:52 2025-02-03 20:32:52,267 - asyncio - ERROR - Task exception was never retrieved
2025-02-03 15:32:52 future: <Task finished name='Task-69694' coro=<ReactionEvents._on_raw_message_reaction_add() done, defined at /usr/local/lib/python3.11/site-packages/interactions/api/events/processors/reaction_events.py:66> exception=HTTPException: 403|Forbidden || Missing Access>
2025-02-03 15:32:52 Traceback (most recent call last):
2025-02-03 15:32:52   File "/usr/local/lib/python3.11/site-packages/interactions/api/events/processors/reaction_events.py", line 68, in onraw_message_reaction_add
2025-02-03 15:32:52     await self._handle_message_reaction_change(event, add=True)
2025-02-03 15:32:52   File "/usr/local/lib/python3.11/site-packages/interactions/api/events/processors/reaction_events.py", line 56, in handlemessage_reaction_change
2025-02-03 15:32:52     message = await self.cache.fetch_message(event.data.get("channel_id"), event.data.get("message_id"))
2025-02-03 15:32:52               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-03 15:32:52   File "/usr/local/lib/python3.11/site-packages/interactions/client/smart_cache.py", line 396, in fetch_message
2025-02-03 15:32:52     data = await self._client.http.get_message(channel_id, message_id)
2025-02-03 15:32:52            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-03 15:32:52   File "/usr/local/lib/python3.11/site-packages/interactions/api/http/http_requests/messages.py", line 101, in get_message
2025-02-03 15:32:52     result = await self.request(
2025-02-03 15:32:52              ^^^^^^^^^^^^^^^^^^^
2025-02-03 15:32:52   File "/usr/local/lib/python3.11/site-packages/interactions/api/http/http_client.py", line 467, in request
2025-02-03 15:32:52     await self._raise_exception(response, route, result)
2025-02-03 15:32:52   File "/usr/local/lib/python3.11/site-packages/interactions/api/http/http_client.py", line 483, in raiseexception
2025-02-03 15:32:52     raise Forbidden(response, response_data=result, route=route)
2025-02-03 15:32:52 interactions.client.errors.Forbidden: HTTPException: 403|Forbidden || Missing Access```

### Checklist

- [x] I have searched the open issues for duplicates.
- [x] I have shown the entire traceback, if possible.
- [x] I have removed my token from display, if visible.
- [x] I have attempted to debug this myself, and I believe this issue is with the library

### Additional Information

_No response_

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions