bit more logging
This commit is contained in:
parent
248d9d8af8
commit
8a21972cc4
20
app.js
20
app.js
@ -63,14 +63,28 @@ bot.on('message', (msg) => {
|
||||
|
||||
for (const x of jointArray) {
|
||||
if (msg.text && msg.text.toString() === x.NAME) {
|
||||
common.chat(bot, msg, x.NAME)
|
||||
common.chat(bot, msg, x.NAME, logger)
|
||||
}
|
||||
}
|
||||
|
||||
for (const x of commands) {
|
||||
if (msg.text && msg.text.toString().includes(x.NAME)) {
|
||||
common.commands(bot, msg, x.NAME)
|
||||
common.commands(bot, msg, x.NAME, logger)
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
if (msg.text && msg.text.toString().includes("/chat")) {
|
||||
const chatId = msg.chat.id;
|
||||
match = msg.text.match(/([^\s]+)/g);
|
||||
const resp = match[1]; // the captured "whatever"
|
||||
|
||||
// for (const x of jointArray) {
|
||||
// if (resp === x.NAME) {
|
||||
// common.chat(bot, msg, resp)
|
||||
// }
|
||||
// }
|
||||
bot.sendMessage(msg.chat.id, resp, logger)
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
const decache = require('decache');
|
||||
|
||||
module.exports = {
|
||||
commands: async (bot, msg, input) => {
|
||||
commands: async (bot, msg, input, logger) => {
|
||||
logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " did - " + input);
|
||||
const userMention = "<a href=\"tg:\/\/user?id=" + msg.from.id + "\">@" + msg.from.first_name + "<\/a> "
|
||||
let commands = require('../../group/commands')
|
||||
for (const x of commands) {
|
||||
@ -17,7 +18,8 @@ module.exports = {
|
||||
}
|
||||
}
|
||||
},
|
||||
chat: async (bot, msg, input) => {
|
||||
chat: async (bot, msg, input, logger) => {
|
||||
logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " asked - " + input);
|
||||
const userMention = "<a href=\"tg:\/\/user?id=" + msg.from.id + "\">@" + msg.from.first_name + "<\/a> "
|
||||
let commands = require('../../group/commands')
|
||||
let navigation = require('../../group/FAQ')
|
||||
|
Loading…
x
Reference in New Issue
Block a user