#Command that takes a user argument from a mention

1 messages · Page 1 of 1 (latest)

smoky bone
#

@balmy mango

balmy mango
#

Yup hi

smoky bone
#

Yo

#

What is it exactly you're trying to do?

balmy mango
#

I'm just trying to get a user from a mention/id of someone

#

Is there anyway I can do that without checking for both cases

#

i.e. if it's not a mention then I check if it's an Id

smoky bone
#

so for example something like
"!greeting @some_person" and it gets their id?

smoky bone
balmy mango
#

no

balmy mango
#

in which I have already isolated as arg

hollow dirge
quick etherBOT
#

<:_:818272565419573308> Conditional (ternary) operator
The conditional (ternary) operator is the only JavaScript operator that takes three operands: a condition followed by a question mark (?), then an expression to execute if the condition is truthy followed by a colon (:), and finally the expression to execute if the condition is falsy. This operator is frequently used as an alternative to an if...else statement.

smoky bone
#

ohhhhh right

balmy mango
#

ah so I must check for both cases

#

Thanks a lot 🙂

smoky bone
#

Sorry I was so confused there for a second. Cheers Lawrster

balmy mango
#

@hollow dirge You also mentioned that <Client>.users.fetch(id) can be used to get the User from the ID, but it returns a promise. So how would I implement it into a ternary operator as message.mentions.user.first() does not

hollow dirge
#

(await <Client>.users.fetch(id))

balmy mango
#

Should I make a helper function for that