you take over the complete message content and therefore the error occurs
create a variable and give it the message content
var messageContent = message.content.slice(10);
(slice takes the complete string and truncates it to the length specified)
And then replace the message.content in the sql query with "messageContent".
example:
client.on('message', async message => {
if (message.content.startsWith('?userinfo')) {
var messageContent = message.content.slice(10);
database.query('SELECT members FROM usertable WHERE username=?', [messageContent], function (err,results) {
if (err) {
throw err;
}
//console.log(results[0]);
var resultArray = Object.values(JSON.parse(JSON.stringify(results[0])));
console.log(resultArray);
steamid = resultArray;
})
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…