Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commands are not sending to the server console #40

Open
Meow-Bots opened this issue Feb 1, 2022 · 6 comments
Open

Commands are not sending to the server console #40

Meow-Bots opened this issue Feb 1, 2022 · 6 comments

Comments

@Meow-Bots
Copy link

Meow-Bots commented Feb 1, 2022

This is my .js

var Rcon = require('/home/kibee/node_modules/rcon/node-rcon')

var options = {
tcp: true,
challenge: false
};

var UwU = new Rcon('ip', port, 'passwords', options);

UwU.on('auth', function() {
console.log("Authenticated <3");
}).on('response', function(str) {
console.log("Got response: " + str);
}).on('end', function() {
console.log("Socket closed!");
});

UwU.connect();

when i connect to the server it sent Authenticated <3, i also tried UwU.send("help"); and it works when the command is from the .js
but when i sent the command from my rcon it just doesnt work.
its rcon for minecraft btw.

@pushrax
Copy link
Owner

pushrax commented Feb 3, 2022

it works when the command is from the .js but when i sent the command from my rcon it just doesnt work.

I don't follow, can you clarify which cases are working and which are not?

One piece of standard advice is to make sure you're sending the command after the authentication callback happens, for example:

UwU.on('auth', function() {
  console.log("Authenticated <3");
  UwU.send("help");
}).on('response', function(str) {
  console.log("Got response: " + str);
}).on('end', function() {
  console.log("Socket closed!");
});

@Meow-Bots
Copy link
Author

Meow-Bots commented Feb 5, 2022

what I meant is, the commands only work when I put them in the js file
like this is my js

var Rcon = require('/home/kibee/node_modules/rcon/node-rcon')

var options = {
tcp: true,
challenge: false
};

var UwU = new Rcon('ubuntu-ts.meowbot.moe', 32869, 'Lks1543562879@@', options);

UwU.on('auth', function() {
console.log("Authenticated <3");
console.log("Sending command: help")
UwU.send("/help");
}).on('response', function(str) {
console.log("Got response: " + str);
}).on('end', function() {
console.log("Socket closed!");
});

UwU.connect();

the /help command worked when i launch the js file
but when i type /help, the command didnt send to the rcon server and nothing happened
Untitled3

@pushrax
Copy link
Owner

pushrax commented Feb 7, 2022

This library doesn’t handle console input. Sending commands is left to the user. If you would like to send commands from console input, try out this example https://github.com/pushrax/node-rcon/blob/master/examples/stdio.js

@Meow-Bots
Copy link
Author

I just tried the example, the most thing works fine but the backspace key doesn't work.

@pushrax
Copy link
Owner

pushrax commented Feb 10, 2022

Which terminal software are you using? This code is supposed to handle backspace, but the escape code it's using may not be compatible with all terminals.

} else if (key && key.name == 'backspace') {
buffer = buffer.slice(0, -1);
process.stdout.write("\033[K"); // Clear to end of line

@Meow-Bots
Copy link
Author

Meow-Bots commented Feb 13, 2022

I was using Tabby Terminal, now I just tried on Windows PowerShell and it doesn't work either.
Same thing with the Windows command prompt.
When I press backspace I got this:
Untitled4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants