Created
March 30, 2021 17:30
-
-
Save rama-adi/527f5b1c8b14d3750c76def9c43929e3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function resolveUid(client, username) { | |
const parsed_username = username.replace('@', ''); | |
return (typeof username === 'undefined' || username === '') | |
? {resolved: false, uid: null} | |
: ( | |
(typeof await client.users.get(username).id === 'undefined') | |
? {resolved: false, uid: null} | |
: {resolved: true, uid: await client.users.get(username).id} | |
); | |
} | |
// usage | |
await resolveUid(dogehouseclient, 'onebyte'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
very kewl