mirror of https://gitlab.com/litecord/litecord.git
parent
0eec28a058
commit
935b4e15aa
|
|
@ -147,10 +147,12 @@ async def make_friend(user_id: int, peer_id: int,
|
||||||
|
|
||||||
|
|
||||||
class RelationshipFailed(BadRequest):
|
class RelationshipFailed(BadRequest):
|
||||||
|
"""Exception for general relationship errors."""
|
||||||
error_code = 80004
|
error_code = 80004
|
||||||
|
|
||||||
|
|
||||||
class RelationshipBlocked(BadRequest):
|
class RelationshipBlocked(BadRequest):
|
||||||
|
"""Exception for when the peer has blocked the user."""
|
||||||
error_code = 80001
|
error_code = 80001
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -163,12 +165,12 @@ async def post_relationship():
|
||||||
str(j['discriminator']))
|
str(j['discriminator']))
|
||||||
|
|
||||||
if not uid:
|
if not uid:
|
||||||
raise RelationshipFailed()
|
raise RelationshipFailed('No users with DiscordTag exist')
|
||||||
|
|
||||||
res = await make_friend(user_id, uid)
|
res = await make_friend(user_id, uid)
|
||||||
|
|
||||||
if res is None:
|
if res is None:
|
||||||
raise RelationshipBlocked()
|
raise RelationshipBlocked('Can not friend user due to block')
|
||||||
|
|
||||||
return '', 204
|
return '', 204
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue