-
Posts
6 -
Joined
-
Last visited
jazz's Achievements
-
jazz reacted to a post in a topic: Custom Storage Engine
-
jazz reacted to a post in a topic: Multiple clients (bots)
-
Stupid me
-
Both use the same secret. What explains this behavior?
-
jazz started following Custom Storage Engine and Multiple clients (bots)
-
Found. Now works fine. var mysql = require('mysql'); var connection = mysql.createConnection({ host : reldb_host, user : reldb_user, password : reldb_password, database : reldb // ssl : { ca : fs.readFileSync(__dirname + '/mysql-ca.crt') } }); connection.connect(function(err) { if (err) { console.error('error connecting: ' + err.stack); return; } console.log('connected as id ' + connection.threadId); }); user.storage.on('save', function(filename, contents, callback) { connection.query('REPLACE INTO `jsteam_custom_storage` (`filename`, `content`) VALUES (?, ?);', [filename, contents], function(err, results) { callback(err); }); }); user.storage.on('read', function(filename, callback) { connection.query('SELECT `content` FROM `jsteam_custom_storage` WHERE `filename` = ?', [filename], function (err, results, fields) { if(err) { callback(err); return; } if(results.length) {console.log(results); callback(null, results[0].content); } else { callback(new Error("File not found")); }; }); }); I wanted to add init.sql, but cloudflare banned me with that.upd: changed.
-
My example for mysql: user.storage.on('save', function(filename, contents, callback) { connection.query('REPLACE INTO `jsteam_custom_storage` (`filename`, `content`) VALUES (?, ?);', [filename, contents], function(err, results) { callback(err); }); }); user.storage.on('read', function(filename, callback) { connection.query('SELECT `content` FROM `jsteam_custom_storage` WHERE `filename` = ?', [filename], function (err, results, fields) { if(err) { callback(err); return; } callback(null, results[0].content); }); }); Please, tell me, what I need call back, when file does not exist (e. g. first start)?
-
Maybe he want the army of bots on a single machine.
-
jazz reacted to a post in a topic: bind ip to node-steam-user
-
Hi, may I connect to Steam Api via ipv6?