Fix(telegram) global functions
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"activate_telegram": false,
|
"activate_telegram": true,
|
||||||
"printer_device_id": "Microsoft Print to PDF",
|
"printer_device_id": "Microsoft Print to PDF",
|
||||||
"debug": true
|
"debug": true
|
||||||
}
|
}
|
||||||
19
src/index.js
19
src/index.js
@@ -23,12 +23,21 @@ const printerName = config.printer_device_id;
|
|||||||
const PORT = config.port || 2000;
|
const PORT = config.port || 2000;
|
||||||
const cacheFolder = "./cache/"
|
const cacheFolder = "./cache/"
|
||||||
|
|
||||||
|
let bot = null;
|
||||||
|
|
||||||
|
const messageIDs = [1034133487]
|
||||||
|
|
||||||
|
function sendMessage(msg, idList) {
|
||||||
|
idList.forEach((id) => {
|
||||||
|
bot.sendMessage(id, msg);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
if (config.activate_telegram) {
|
if (config.activate_telegram) {
|
||||||
const token = '6150769224:AAGhBagPEi23QtBJl65YNuwEBBXwHguDV0E';
|
const token = '6150769224:AAGhBagPEi23QtBJl65YNuwEBBXwHguDV0E';
|
||||||
|
|
||||||
const messageIDs = [1034133487]
|
|
||||||
|
|
||||||
const bot = new TelegramBot(token, { polling: true });
|
bot = new TelegramBot(token, { polling: true });
|
||||||
|
|
||||||
bot.setMyCommands([
|
bot.setMyCommands([
|
||||||
{ command: '/chatid', description: 'Zeigt deine Chat ID' },
|
{ command: '/chatid', description: 'Zeigt deine Chat ID' },
|
||||||
@@ -56,11 +65,7 @@ if (config.activate_telegram) {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function sendMessage(msg, idList) {
|
|
||||||
idList.forEach((id) => {
|
|
||||||
bot.sendMessage(id, msg);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
sendMessage("[INFO]: Drucker Service wird gestartet", messageIDs)
|
sendMessage("[INFO]: Drucker Service wird gestartet", messageIDs)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user