我有一个命令,我希望该用户只能写数字,而不是单词(!翻转测试...)如何正确编写?以后我自己做,如果用户在1个参数中写了一个文本,机器人会回答他:你不能把它写下来,写下数字
我的代码在这里:
if (!args[0]) return message.channel.send(`${message.author}, You forgot to write a bet!`)
检查是否args[0]
不是数字isNaN()
if(isNaN(args[0])) return message.reply('you need to enter a number!')
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句