-4

My current code

let person = message.mentions.users.first()
let characterInAMention = // I don't know what i've need to write here.

I don't know what i need to write

HamzahF
  • 19
  • 4

1 Answers1

0

Simply use .length

E.g:

let person = message.mentions.users.first()
let characterInAMention = person.username.length //as Zsolt mentioned below

I would recommend learning Javascript to a good degree before starting coding bots, and do try to consult the docs before asking.

Joe Moore
  • 2,031
  • 2
  • 8
  • 29
  • Yeah, you teaching me 20 minutes after i learn it, LOL – HamzahF Mar 05 '21 at 01:05
  • I'm not sure how this answer is accepted. There is no way it works; `person` is either `undefined` (no mention), or an object (`User`) that doesn't have a `length` property. If there is no mention, it throws a TypeError. If there is a mention, `person.length` is `undefined`. Maybe `person.username.length` would work but what if the member has a nickname. In that case the mentioned name's length will be different. Anyway, I'm not even sure what OP is asking, the question should be updated. – Zsolt Meszaros Mar 05 '21 at 08:52
  • Oh god you're right, I will fix it now, my mistake – Joe Moore Mar 05 '21 at 09:01