const fwdId = #ID СУПЕРГРУППЫ#;
const first_name = msg.chat.first_name;
bot.on('message', (msg) => {
const chatId = msg.chat.id;
if (msg.text) {
const text = msg.text.toLowerCase();
if (~text.indexOf("привет")) {bot.sendMessage(chatId, 'Привет, ' + first_name + '!');}
else if (~text.indexOf("start")) {}
else (chatId != fwdId) {bot.forwardMessage(fwdId, chatId, msg.message_id);}
}
});
[{"id":"20fc1f49.0ac97","type":"drom-tg-updates","z":"816191d5.cb781","name":"","method":"longpoll","property":"tgUpdate","client":"8ab3ffbd.097a1","x":440,"y":320,"wires":[["581f6191.a03c4"]]},{"id":"581f6191.a03c4","type":"drom-tg-switch-update","z":"816191d5.cb781","name":"Какое событие?","tgUpdate":"tgUpdate","property":"tgUpdateObj","updates":["message"],"outputs":1,"x":770,"y":320,"wires":[["f1b47a6d.c871d8"]]},{"id":"9a5462b0.20203","type":"drom-tg-api-call","z":"816191d5.cb781","name":"Форвард сообщения","data":"apiData","dataType":"msg","method":"forwardMessage","methodType":"str","property":"apiRes","client":"8ab3ffbd.097a1","x":1400,"y":300,"wires":[["d700d74.3b99228"]]},{"id":"1f5ca683.997369","type":"change","z":"816191d5.cb781","name":" Id супергруппы","rules":[{"t":"set","p":"apiData.chat_id","pt":"msg","to":"-123456","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":1390,"y":220,"wires":[["a2ffad93.bc7eb"]]},{"id":"f1b47a6d.c871d8","type":"switch","z":"816191d5.cb781","name":"Сообщение в личку Боту?","property":"tgUpdateObj.from.id","propertyType":"msg","rules":[{"t":"eq","v":"tgUpdateObj.chat.id","vt":"msg"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":1100,"y":320,"wires":[["1f5ca683.997369"],["7b7d959c.a503ac"]],"outputLabels":["Да","Нет"]},{"id":"63e53df1.7d73a4","type":"drom-tg-api-call","z":"816191d5.cb781","name":"Отправка ответа","data":"apiData","dataType":"msg","method":"sendMessage","methodType":"str","property":"payload","client":"8ab3ffbd.097a1","x":1690,"y":420,"wires":[[]]},{"id":"6c4344ad.334b9c","type":"change","z":"816191d5.cb781","name":"Данные tg api","rules":[{"t":"set","p":"apiData.chat_id","pt":"msg","to":"message_sender[0].value2","tot":"msg"},{"t":"set","p":"apiData.text","pt":"msg","to":"tgUpdateObj.text","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1680,"y":380,"wires":[["63e53df1.7d73a4"]]},{"id":"a2ffad93.bc7eb","type":"change","z":"816191d5.cb781","name":"Данные tg api","rules":[{"t":"set","p":"apiData.from_chat_id","pt":"msg","to":"tgUpdateObj.from.id","tot":"msg"},{"t":"set","p":"apiData.message_id","pt":"msg","to":"tgUpdateObj.message_id","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1380,"y":260,"wires":[["9a5462b0.20203"]]},{"id":"7e643f.62614bc","type":"drom-data-relationships-num","z":"816191d5.cb781","storage":"6c999ed1.7d41f","action":"setup-rels","rels":"message_sender","relsType":"storId","value1":"inviter","value1Type":"msg","value2":"invitee","value2Type":"msg","value1Req":"inviter","value1ReqType":"msg","value2Req":"invitee","value2ReqType":"msg","limitRes":"20","limitResType":"num","offsetRes":"0","offsetResType":"num","name":"","property":"payload","x":800,"y":140,"wires":[[]]},{"id":"f553b75.a386048","type":"inject","z":"816191d5.cb781","name":"Настроить хранение данных","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":460,"y":140,"wires":[["7e643f.62614bc"]]},{"id":"d700d74.3b99228","type":"drom-data-relationships-num","z":"816191d5.cb781","storage":"6c999ed1.7d41f","action":"add","rels":"message_sender","relsType":"storId","value1":"inviter","value1Type":"msg","value2":"invitee","value2Type":"msg","value1Req":"apiRes.message_id","value1ReqType":"msg","value2Req":"tgUpdateObj.from.id","value2ReqType":"msg","limitRes":"20","limitResType":"num","offsetRes":"0","offsetResType":"num","name":"Добав в message_sender","property":"payload","x":1710,"y":260,"wires":[[]]},{"id":"7b7d959c.a503ac","type":"switch","z":"816191d5.cb781","name":"Ответ?","property":"tgUpdateObj","propertyType":"msg","rules":[{"t":"hask","v":"reply_to_message","vt":"str"}],"checkall":"false","repair":false,"outputs":1,"x":1160,"y":380,"wires":[["3c811c29.b17d74"]],"outputLabels":["Да"]},{"id":"3c811c29.b17d74","type":"drom-data-relationships-num","z":"816191d5.cb781","storage":"6c999ed1.7d41f","action":"get","rels":"message_sender","relsType":"storId","value1":"tgUpdateObj.reply_to_message.message_id","value1Type":"msg","value2":"","value2Type":"undef","value1Req":"apiRes.message_id","value1ReqType":"msg","value2Req":"tgUpdateObj.from.id","value2ReqType":"msg","limitRes":"","limitResType":"undef","offsetRes":"0","offsetResType":"num","name":"Найти в message_sender","property":"message_sender","x":1410,"y":380,"wires":[["ed52d334.5457c"]]},{"id":"ed52d334.5457c","type":"switch","z":"816191d5.cb781","name":"Есть?","property":"message_sender","propertyType":"msg","rules":[{"t":"nempty"}],"checkall":"false","repair":false,"outputs":1,"x":1470,"y":420,"wires":[["6c4344ad.334b9c"]],"outputLabels":["Да"]},{"id":"35df003b.499d4","type":"comment","z":"816191d5.cb781","name":"Настройка","info":"","x":400,"y":100,"wires":[]},{"id":"8ab3ffbd.097a1","type":"drom-tg-api-config","name":"Мой Telegram Бот"},{"id":"6c999ed1.7d41f","type":"drom-data-config","name":"","dbType":"sqlite","sqliteFile":"my-data.sqlite"}]