fix
Deploy app frontend / app frontend (push) Successful in 2m40s
Deploy service couchdb / service couchdb (push) Successful in 31s
Deploy db-migrations / db-migrations (push) Successful in 1m56s
Deploy service message-delivery-method-web-push / service message-delivery-method-web-push (push) Successful in 1m37s
Deploy service tg-bot / service tg-bot (push) Failing after 2m0s
Deploy app frontend / app frontend (push) Successful in 2m40s
Deploy service couchdb / service couchdb (push) Successful in 31s
Deploy db-migrations / db-migrations (push) Successful in 1m56s
Deploy service message-delivery-method-web-push / service message-delivery-method-web-push (push) Successful in 1m37s
Deploy service tg-bot / service tg-bot (push) Failing after 2m0s
This commit is contained in:
@@ -71,6 +71,7 @@ services:
|
|||||||
- API_URL=http://${COUCHDB_USER}:${COUCHDB_PASSWORD}@couchdb:5984
|
- API_URL=http://${COUCHDB_USER}:${COUCHDB_PASSWORD}@couchdb:5984
|
||||||
- BOT_TOKEN=${BOT_TOKEN:-}
|
- BOT_TOKEN=${BOT_TOKEN:-}
|
||||||
- READ_BASE_URL=${READ_BASE_URL:-}
|
- READ_BASE_URL=${READ_BASE_URL:-}
|
||||||
|
- APP_BASE_URL=${TG_BOT_APP_BASE_URL:-}
|
||||||
- HEARTBEAT_INTERVAL=${HEARTBEAT_INTERVAL:-30000}
|
- HEARTBEAT_INTERVAL=${HEARTBEAT_INTERVAL:-30000}
|
||||||
- DEBUG=${TG_BOT_DEBUG:-}
|
- DEBUG=${TG_BOT_DEBUG:-}
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { MyContext } from "../../types/myContext";
|
|
||||||
import { qrDb, messagesDb } from "../../dbs";
|
|
||||||
import type { MessageDocument } from "@hereconnect/types";
|
import type { MessageDocument } from "@hereconnect/types";
|
||||||
import { secondsToISOString } from "../../utils/date";
|
import { MyContext } from "../../types/myContext";
|
||||||
import { env } from "../../config/env";
|
import { env } from "../../config/env";
|
||||||
|
import { qrDb, messagesDb } from "../../dbs";
|
||||||
|
import { secondsToISOString } from "../../utils/date";
|
||||||
import { escapeHtml } from "../../utils/escapeHtml";
|
import { escapeHtml } from "../../utils/escapeHtml";
|
||||||
|
|
||||||
const qrCodeMessageRegexp = /#qr(?<qr_code_uri>\S+)_c(?<chat>\S+)/;
|
const qrCodeMessageRegexp = /#qr(?<qr_code_uri>\S+)_c(?<chat>\S+)/;
|
||||||
@@ -34,7 +34,7 @@ export const forwardQrCodeMessageMiddleware = async (
|
|||||||
if (!m?.groups) {
|
if (!m?.groups) {
|
||||||
console.log("m.groups is empty", m, m?.groups);
|
console.log("m.groups is empty", m, m?.groups);
|
||||||
await ctx.reply(
|
await ctx.reply(
|
||||||
`Я не смогу обработать это сообщение.\nВыберете в телеграм ответить у любого сообщения QR-кода чтобы я его мог переслать в диалог.`,
|
`не возможно обработать это сообщение.\nВыберете в телеграм ответить у любого сообщения QR-кода чтобы я его мог переслать в диалог.`,
|
||||||
);
|
);
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
@@ -48,23 +48,26 @@ export const forwardQrCodeMessageMiddleware = async (
|
|||||||
|
|
||||||
if (!qrCodeDoc) {
|
if (!qrCodeDoc) {
|
||||||
await ctx.reply(
|
await ctx.reply(
|
||||||
`Я не смогу обработать это сообщение. QR-код с ID ${qr_code_uri} не найден.`,
|
`Не возможно обработать это сообщение. QR-код с ID ${qr_code_uri} не найден.`,
|
||||||
{ reply_to_message_id: ctx.msg.message_id },
|
{ reply_to_message_id: ctx.msg.message_id },
|
||||||
);
|
);
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ctx.userDoc) {
|
if (!ctx.userDoc) {
|
||||||
await ctx.reply(`Я не смогу обработать это сообщение. Вы не авторизованы`, {
|
await ctx.reply(
|
||||||
|
`Не возможно обработать это сообщение. Вы не авторизованы`,
|
||||||
|
{
|
||||||
reply_to_message_id: ctx.msg.message_id,
|
reply_to_message_id: ctx.msg.message_id,
|
||||||
});
|
},
|
||||||
|
);
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(ctx.userDoc?.telegram_id, "!==", qrCodeDoc.telegram_id);
|
console.log(ctx.userDoc?.telegram_id, "!==", qrCodeDoc.telegram_id);
|
||||||
|
|
||||||
if (ctx.userDoc?.user_uuid !== qrCodeDoc.user_uuid) {
|
if (ctx.userDoc?.user_uuid !== qrCodeDoc.user_uuid) {
|
||||||
await ctx.reply(`Я не смогу обработать это сообщение. Это не ваш QR-код`, {
|
await ctx.reply(`Не возможно обработать это сообщение. Это не ваш QR-код`, {
|
||||||
reply_to_message_id: ctx.msg.message_id,
|
reply_to_message_id: ctx.msg.message_id,
|
||||||
});
|
});
|
||||||
return next();
|
return next();
|
||||||
@@ -88,7 +91,7 @@ export const forwardQrCodeMessageMiddleware = async (
|
|||||||
|
|
||||||
const hashTag = `#qr${qr_code_uri}_c${chat}`;
|
const hashTag = `#qr${qr_code_uri}_c${chat}`;
|
||||||
const manageMessageUrl = `${env.APP_BASE_URL}/manage/qr/${qr_code_uri}/chat/${chat}#message-${encodeURIComponent(created_at)}`;
|
const manageMessageUrl = `${env.APP_BASE_URL}/manage/qr/${qr_code_uri}/chat/${chat}#message-${encodeURIComponent(created_at)}`;
|
||||||
const text = `<i><a href="${escapeHtml(manageMessageUrl)}">диалог QR-кода <b>«${escapeHtml(qrCodeDoc.name)}»</b></a> ${escapeHtml(hashTag)}</i>`;
|
const text = `<i>сообщение <a href="${escapeHtml(manageMessageUrl)}">диалог QR-кода <b>«${escapeHtml(qrCodeDoc.name)}»</b></a> ${escapeHtml(hashTag)}</i>`;
|
||||||
|
|
||||||
// await ctx.react("⚡");
|
// await ctx.react("⚡");
|
||||||
await ctx.reply(text, {
|
await ctx.reply(text, {
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ if (!process.env.READ_BASE_URL) {
|
|||||||
throw new Error("Необходимо указать READ_BASE_URL в переменных окружения.");
|
throw new Error("Необходимо указать READ_BASE_URL в переменных окружения.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!process.env.APP_BASE_URL) {
|
||||||
|
throw new Error("Необходимо указать APP_BASE_URL в переменных окружения.");
|
||||||
|
}
|
||||||
|
|
||||||
if (!process.env.API_URL) {
|
if (!process.env.API_URL) {
|
||||||
throw new Error("Environment variable API_URL is not set");
|
throw new Error("Environment variable API_URL is not set");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user