git more logging

This commit is contained in:
karl.hudgell 2020-06-23 11:13:27 +01:00
parent 7b8cb8ed68
commit 2b48cbade4

7
app.js
View File

@ -23,7 +23,7 @@ const bot = new TelegramBot(token, {
// Wlecome Message // Wlecome Message
bot.on('new_chat_members', (msg) => { bot.on('new_chat_members', (msg) => {
const newUserMention = "<a href=\"tg:\/\/user?id=" + msg.new_chat_member.id + "\">@" + msg.new_chat_member.first_name + "<\/a>" const newUserMention = "<a href=\"tg:\/\/user?id=" + msg.new_chat_member.id + "\">@" + msg.new_chat_member.first_name + "<\/a>"
bot.sendMessage(msg.chat.id,"Hello " + newUserMention + ", Welcome to " + channel + ". \n\nPlease PM me @" + process.env.BOT_USERNAME + " to find out all needed information about our service before asking an admin or posting in here.\n\nIf you do ask questions, and its obvious you have not spoken to me, we might not take it well.", { parse_mode: "HTML" }); bot.sendMessage(msg.chat.id,"Hello " + newUserMention + ", Welcome to " + channel + ". \n\nPlease PM me @" + process.env.BOT_USERNAME + " to find out all needed information about our service before asking an admin or posting in here.\n\nIf you do ask questions, and its obvious you have not spoken to me, you will be booted from the room. This is IPTV, admins don't have time for hand holding.!!!", { parse_mode: "HTML" });
logger.info("ID - " + msg.new_chat_member.id + " First Name - " + msg.new_chat_member.first_name + " joined the group"); logger.info("ID - " + msg.new_chat_member.id + " First Name - " + msg.new_chat_member.first_name + " joined the group");
}); });
@ -76,7 +76,7 @@ bot.on('message', (msg) => {
request(options, function (error, response, body) { request(options, function (error, response, body) {
if (error) throw new Error(error); if (error) throw new Error(error);
console.log(body); // console.log(body);
let jsonBody = JSON.parse(body) let jsonBody = JSON.parse(body)
if (jsonBody.data.length > 0) { if (jsonBody.data.length > 0) {
bot.sendMessage(msg.chat.id, 'Yes there is!').then(() => { bot.sendMessage(msg.chat.id, 'Yes there is!').then(() => {
@ -84,8 +84,7 @@ bot.on('message', (msg) => {
var homeTeam = entry.localTeam.data.name var homeTeam = entry.localTeam.data.name
var awayTeam = entry.visitorTeam.data.name var awayTeam = entry.visitorTeam.data.name
var startTime = entry.time.starting_at.time var startTime = entry.time.starting_at.time
// console.log(entry);
console.log(entry);
bot.sendMessage(msg.chat.id, homeTeam + " VS " + awayTeam + " @ " + startTime) bot.sendMessage(msg.chat.id, homeTeam + " VS " + awayTeam + " @ " + startTime)
}); });
}) })