48 lines
1.9 KiB
JavaScript
Raw Normal View History

2025-07-30 09:51:32 +01:00
const utils = require('./utils');
2020-06-30 16:25:55 +00:00
module.exports = {
2020-07-01 18:14:45 +00:00
commands: async (bot, msg, input, logger) => {
2020-07-01 18:13:04 +00:00
logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " did - " + input);
2020-06-30 16:25:55 +00:00
const userMention = "<a href=\"tg:\/\/user?id=" + msg.from.id + "\">@" + msg.from.first_name + "<\/a> "
2025-07-30 09:51:32 +01:00
let commands = utils.loadCommands();
2020-06-30 16:25:55 +00:00
for (const x of commands) {
if (x.NAME === input) {
let n = x.NAME
let t = x.TEXT
for (const m of t) {
let a = userMention.concat(m)
await bot.sendMessage(msg.chat.id, a, { parse_mode: "HTML" })
}
2025-07-30 09:51:32 +01:00
commands = utils.loadCommands();
2020-06-30 16:25:55 +00:00
}
}
},
2020-07-01 18:14:45 +00:00
chat: async (bot, msg, input, logger) => {
2020-07-01 18:13:04 +00:00
logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " asked - " + input);
2020-06-30 16:25:55 +00:00
const userMention = "<a href=\"tg:\/\/user?id=" + msg.from.id + "\">@" + msg.from.first_name + "<\/a> "
2025-07-30 09:51:32 +01:00
let commands = utils.loadCommands();
let navigation = utils.loadFAQ();
let chat = utils.loadChat();
2020-06-30 16:25:55 +00:00
let jointArray = commands.concat(navigation, chat)
for (const x of jointArray) {
if (x.NAME === input) {
let n = x.NAME
let t = x.TEXT
let m = JSON.parse(x.MENU)
for (const d of t) {
let a = userMention.concat(m)
await bot.sendMessage(msg.chat.id, d, {
parse_mode: "HTML",
"reply_markup": {
"keyboard": m
2023-12-05 13:39:29 +00:00
},
disable_web_page_preview: true
2020-06-30 16:25:55 +00:00
})
}
2025-07-30 09:51:32 +01:00
commands = utils.loadCommands();
navigation = utils.loadFAQ();
2020-06-30 16:25:55 +00:00
}
}
}
};