From 8c8e6387d5a435ef429b095130e391103c9328f1 Mon Sep 17 00:00:00 2001 From: Pierre-Gilles Leymarie Date: Tue, 28 Jul 2020 17:37:08 +0200 Subject: [PATCH] Fix #607 : In Telegram service, use the chat.id to answer to a user, not the from.id --- server/services/telegram/lib/message.new.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/services/telegram/lib/message.new.js b/server/services/telegram/lib/message.new.js index 20387f3802..2830bb634a 100644 --- a/server/services/telegram/lib/message.new.js +++ b/server/services/telegram/lib/message.new.js @@ -12,18 +12,21 @@ const { EVENTS } = require('../../../utils/constants'); async function newMessage(msg) { logger.debug(`new message from telegram, ${msg.text}`); logger.debug(msg); + const telegramUserId = msg.from.id; + const telegramChatId = msg.chat.id; if (msg.text.startsWith('/start')) { const splitted = msg.text.split(' '); await this.linkUser(splitted[1], telegramUserId); return null; } + const user = await this.gladys.user.getByTelegramUserId(telegramUserId); const message = { source: 'telegram', - source_user_id: telegramUserId, + source_user_id: telegramChatId, user_id: user.id, user, language: user.language,