I'm creating a Discord bot. When we asked about an error, the bot gives an answer about that error. But when I get MySQL Data, i'm trying post it to Discord but it saying undefined.
Could you please help me?
const Discord = require("discord.js");
const client = new Discord.Client();
const ayarlar = require("./ayarlar.json");
const mysql = require('mysql');
var baglanti = mysql.createConnection({
host: 'localhost',
user: 'root',
password: '',
database: 'hatabot'
});
baglanti.connect(function (err) {
if (err) throw err;
console.log("baglanti basarili")
client.on('message', msg => {
baglanti.query("SELECT * from hatalar WHERE hata_komut LIKE "+'%'+msg.content+'%',function(err,sonuc){
console.log(msg.content+" kelimesine ait\n\n"+sonuc+"\n\nsonucu bulundu");
});
});
});
client.login(ayarlar.token)