DGVaniX Posted March 17, 2018 Report Posted March 17, 2018 (edited) Hi, so I am making a bot and the user has a "!buy" command that also has a parameter. How do I find out what number the user enters after the command when the user enters it like this "!buy 3"? if (msg.toUpperCase() == '!BUY' && '!BUY' == msg.toUpperCase().substring(0,4)){ if(!isNaN(msg.charAt(5)) && parseInt(msg.charAt(5)) > 0){ var string_start=msg.indexOf("UY"); var nrOfSets= ""; string_start+=3; for (var i = string_start; i < msg.length; i++) { nrOfSets+= msg.charAt(i); } var sets = parseInt(nrOfSets); I tried that but it doesn't work, it just skips to the last "else" which tells the user that the command is not recognized... Thanks. ---- EDIT FIXED! Edited March 17, 2018 by DGVaniX Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.