#Check for if a user with a specific id exists

1 messages · Page 1 of 1 (latest)

weary harness
#

How would I check if a user exists without having an exception thrown due to a failure to send a request to discord?

#

This is probably a pretty basic question, but I think it's a good one to ask

weary harness
weary harness
#

ah, okay

#

provided an id, how would I check whether a user with that id exists? I'm attempting to guard crashes when attempting to unban a user

frank hill
#

what error are you getting?

weary harness
#

404 Unknown User

#

I've been testing the unbanning function with a non-existent user id

#

oop

frank hill
#

you said try catching doesn't work, that sounds strange, it should afaik

weary harness
#

okay, it works now

#

I had to add await to my unbanMember method.

#
[25/07/2024 11:42:47 pm] INFO BOT > Attempting to unban user: 1249012409.
[25/07/2024 11:42:47 pm] ERROR BOT > Could not unban user 1249012409 from guild Greenhouse Modding
#

👍

#

thanks for the help, it was just my code

#

I think warn might be better here

frank hill