Everyone, I built a hello bot and the system works but perfectly there is a small problem, I want the system to display only after typing '$' + the name that is in the database, will display the database.
Code:
var name = (message.content);
var sql = `SELECT * FROM customers WHERE name = ?`;
con.query(sql, [name], function(err, result) {
if (err) throw err;
if (message.content.startsWith(prefix + result[0].name)) {
}
Now, as soon as I print a particular variable it does nothing, but if I type in the database the full name $Example
It invented for me if I used the same code but without prefix +
in the startsWith
call.
How do I make a bot work even if the special character is not listed in the database?