stop on mysql error
This commit is contained in:
6
tgBot.js
6
tgBot.js
@@ -92,10 +92,10 @@ const init = async () => {
|
|||||||
connection.query(querystring, function (error, results, fields) {
|
connection.query(querystring, function (error, results, fields) {
|
||||||
if (error) {
|
if (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
tgBot.sendMessage(data.message.chat.id, "ERR: sorry, I had trouble querying the database.")
|
return tgBot.sendMessage(data.message.chat.id, "ERR: sorry, I had trouble querying the database.")
|
||||||
}
|
}
|
||||||
if (!results) {
|
if (!results[0]) {
|
||||||
tgBot.sendMessage(data.message.chat.id, "WRN: sorry, I didn't find any data matching your request.")
|
return tgBot.sendMessage(data.message.chat.id, "WRN: sorry, I didn't find any data matching your request.")
|
||||||
}
|
}
|
||||||
tgBot.sendMessage(data.message.chat.id, `DASH - Simcompany bot made by OTB\nInformation displayed for ${msgData[2]} q${msgData[1]}\nHighest price (24h): ${results[0]["max"]}\nAverage price (24h): ${results[0]["avg"]}\nLowest price (24h): ${results[0]["min"]}\n`)
|
tgBot.sendMessage(data.message.chat.id, `DASH - Simcompany bot made by OTB\nInformation displayed for ${msgData[2]} q${msgData[1]}\nHighest price (24h): ${results[0]["max"]}\nAverage price (24h): ${results[0]["avg"]}\nLowest price (24h): ${results[0]["min"]}\n`)
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user