Jump to content
McKay Development

Need some help with my bot


Toxic

Recommended Posts

I need some help with my bot.. so here is my problem..

 

I tried making an if statement like this: 

client.on('friendMessage', function (steamID, message) {
	if(steamID == '765611......'){
		client.chatMessage(steamID, 'Working...');
	} else {
		client.chatMessage(steamID, 'You are not my master!');
	}
});

But everytime i send the bot something it sends "Working..." but i want it to only respond with a command like !help or !test

 

Any help or suggestions would be helpful.

Link to comment
Share on other sites

if(steamID == '76561197.....' || steamID == '76561.....'){

 

 

In case if you want the bot accept user command and admin command, you can try this example, or using switch-case:

var admin = "76561..."; //this is admin Steam ID

client.on('friendMessage', function (steamID, message) {
	if((steamID == admin) && (message== "!command1")){
		client.chatMessage(steamID, 'admin command 1');
	}
        else if((steamID == admin) && (message== "!command2")){
		client.chatMessage(steamID, 'admin command 2');
	}
        else if(message== "!user1"){
		client.chatMessage(steamID, 'user command 1');
	}
        else if(message== "!help"){
		client.chatMessage(steamID, '!help command');
	}
        else {
		client.chatMessage(steamID, 'command not found, use !help');
	}
});
Edited by Vanilla
Link to comment
Share on other sites

 

if(steamID == '76561197.....' || steamID == '76561.....'){

 

 

In case if you want the bot accept user command and admin command, you can try this example, or using switch-case:

var admin = "76561..."; //this is admin Steam ID

client.on('friendMessage', function (steamID, message) {
	if((steamID == admin) && (message== "!command1")){
		client.chatMessage(steamID, 'admin command 1');
	}
        else if((steamID == admin) && (message== "!command2")){
		client.chatMessage(steamID, 'admin command 2');
	}
        else if(message== "!user1"){
		client.chatMessage(steamID, 'user command 1');
	}
        else if(message== "!help"){
		client.chatMessage(steamID, '!help command');
	}
        else {
		client.chatMessage(steamID, 'command not found, use !help');
	}
});

Thanks works perfectly now

Link to comment
Share on other sites

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...