#I dont think I was wrong. I want if it has 6 digits to return a message but they are only numeric.

1 messages · Page 1 of 1 (latest)

arctic pilot
#

So you have an output, and if it has less than 6 digits, you want to delete the reply?

#

but they are only numeric.
I'm pretty sure digits are always numeric, no matter what digits

floral robin
#

yes

#

example

#

123456 (return msg)

#

#123456 (7 digits) return message

arctic pilot
#

But # is not a digit

floral robin
#

yes i see

arctic pilot
#

Then you want to check the amount of digits in the whole message.content?

floral robin
#

I'll fix this later with starts.with. my problem now is with the numbers

arctic pilot
#

If you do get numbers, which you suggest, but I doubt, you can check if the number has at least 6 digits with: number / 100000 > 0

arctic pilot
#

Actually it is overdone, you can check easier with number > 99999

floral robin
#

my command basic

client.on('message', message => {
 if (message.author.bot) return;
 if (message.channel.type == 'dm') return;
 if (message.content.length > 6) return message.delete()
return message.channel.send('this is')
})

arctic pilot
#

What your command does is: deleting the message if message.content (which includes #) has more than 6 chars

#

Probably you want if(message.content.substring(...).length < 6) ...

floral robin
#

hm

#

dont work

#

use only number

#

example

#

for me

#

message content

arctic pilot
#

What??

#

Maybe I can help you better if you show me some input -> output examples

floral robin
#

I just want that if it has 6 digits return the message

arctic pilot
#

And what if it has less than 6?

floral robin
#

if you have 6 I just need it now

arctic pilot
#

I meant, what if there are more or less than 6 digits in the message?

#

Do you still have to return a message?

floral robin
#

not only 6 numbers return message. if you don't have the command it won't even work

arctic pilot
#
client.on('message', message => {
  if (message.author.bot) return;
  if (message.channel.type == 'dm') return;
  if (!message.content.startsWith(`#`)) return;

  let token_length = `#`.length;
  if (message.content.length - token_length != 6) return message.delete();

  return message.channel.send('this is');
});
#

Also, take note that message event is likely deprecated

floral robin
#

wtf

#

token length is not a defined

#

oh yes

#

your edit

#

that's what you sent delete just #

#

forgets this #

#

Only Numbers

#

Numbers

#

not substring

arctic pilot
#

What is proposal? Are you making a bot for someone else?

floral robin
#

so forget this idea of ​​#

#

focus on the idea of ​​numbers can you do that?

arctic pilot
#

Can you please answer my last questions? Otherwise someone else can come here and help you

#

What is proposal? Are you making a bot for someone else?

#

Ok, well, not that I really care...:

if (isNaN(message.content) || message.content.length != 6) return message.delete();
return message.channel.send('this is');
#

What's the deal?

#

Do you not know what || means?

#

Yes

#

Any other text IS NOT a 6 digit number

#

Sorry, but your english seems kinda broken, so it's hard to understand you... You want to filter only numbers?

#

Which means letting all random text pass-through

#

Yes
Yes
Yes
if (!isNaN(message.content) && message.content.length != 6) return message.delete();

#

Your messages got deleted, maybe a mod banned you?