Jump to content
McKay Development

Recommended Posts

Posted (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 by DGVaniX

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...