discord.py-self
discord.py-self copied to clipboard
Can't accept incoming friend request
Summary
Accepting a friend request results in an error.
Reproduction Steps
I have an event subscriber for incoming friend requests and it should automatically accept these requests. See code below.
Code
async def on_relationship_add(self, relationship):
"""Event subscriber for when a relationship is added"""
if relationship.type == discord.RelationshipType.incoming_request:
await relationship.accept()
Expected Results
The friend request should be accepted.
Actual Results
Traceback (most recent call last):
File "bot/venv/lib/python3.8/site-packages/discord/client.py", line 301, in _run_event
await coro(*args, **kwargs)
File "main.py", line 43, in on_relationship_add
await relationship.accept()
File "bot/venv/lib/python3.8/site-packages/discord/relationship.py", line 87, in accept
await self._state.http.add_relationship(self.user.id, action=RelationshipAction.accept_request)
File "bot/venv/lib/python3.8/site-packages/discord/http.py", line 302, in request
raise HTTPException(r, data)
discord.errors.HTTPException: 400 Bad Request (error code: 0)
System Information
- Python v3.8.10-final
- discord.py-self v1.9.2-final
- aiohttp v3.7.4.post0
- system info: Linux 5.15.0-52-generic # 58~20.04.1-Ubuntu SMP Thu Oct 13 13:09:46 UTC 2022
Checklist
- [X] I have searched the open issues for duplicates.
- [X] I have shared the entire traceback.
- [X] I am using a user token (and it isn't visible in the code).
Additional Information
I have seen this behaviour on v1.9.2 and the latest v2.0.0a (main branch).