Skip to content

Instantly share code, notes, and snippets.

@rama-adi
Created March 30, 2021 17:30
Show Gist options
  • Save rama-adi/527f5b1c8b14d3750c76def9c43929e3 to your computer and use it in GitHub Desktop.
Save rama-adi/527f5b1c8b14d3750c76def9c43929e3 to your computer and use it in GitHub Desktop.
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');
@kasparnoor
Copy link

very kewl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment