Im fairly new to Node, but recently started a Discord Bot. I have the Bot up and running fairly well, taking in commands and giving responses, auto assigning roles upon users agreeing to Rules, Welcoming new users immediately, etc.But when it comes to opening a Telnet Connection im lost.My current connection code looks like:client.once('ready', () => {`console.log('Ready!');` `client.user.setActivity('Im Currently in Testing')` `var interval = setInterval (function () {` client.channels.get("xxxxxxxxxxxx").send("\``Remember to vote for the Server! Those who vote for the Server get Reward points they can then use to buy in-game items.``` Vote here[x](https://bit.ly/2JRwxXx)xxxxxxxxxxxxxxxxx")`}, 72 * 600000);var connection = new Telnet()var params = {host: 'xxxxxxxxxxxxx',port: xxxxxxxxxxxxx,timeout: 15000,username: "",password: 'xxxxxxxxxxxxxxxxxx',passwordPrompt: /Please enter password:/i,shellPrompt: /\r\n$/,debug: false,}connection.connect(params)connection.on('ready', function(prompt) {connection.exec(cmd, function(err, response) {console.log(response)}) `})` `connection.on('timeout', function() {` console.log('socket timeout!')connection.end() `})` `connection.on('close', function() {` console.log('connection closed') `})` `connection.exec("say 'test'");` });This is only causing the console to log "connection closed"Not too sure what im doing wrong, but to be honest, im pretty lost when it comes to Node. Im fairly new and totally do not understand any of the concepts yet other than the basic if and or else statements that most languages seem to use.Thanks in advance, and any tips on where to start with Node would be great.
Submitted July 03, 2019 at 03:33AM by jerseyetr
No comments:
Post a Comment