read tg_bot_updates from db
Deploy app frontend / app frontend (push) Successful in 2m34s
Deploy db-migrations / db-migrations (push) Successful in 1m12s
Deploy service message-delivery-method-web-push / service message-delivery-method-web-push (push) Successful in 1m38s
Deploy service tg-bot / service tg-bot (push) Failing after 2m11s
Deploy app frontend / app frontend (push) Successful in 2m34s
Deploy db-migrations / db-migrations (push) Successful in 1m12s
Deploy service message-delivery-method-web-push / service message-delivery-method-web-push (push) Successful in 1m38s
Deploy service tg-bot / service tg-bot (push) Failing after 2m11s
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.saveUpdateString = exports.saveUpdate = void 0;
|
||||
var saveUpdate = function (doc, req) {
|
||||
var token = req.headers["X-Telegram-Bot-Api-Secret-Token"];
|
||||
if (token !== this.constants.telegram_secret_token) {
|
||||
return [null, { code: 403, body: "Forbidden: Invalid token" }];
|
||||
}
|
||||
var data = JSON.parse(req.body);
|
||||
if (doc) {
|
||||
return [null, { code: 304, body: "Update already exists" }];
|
||||
}
|
||||
doc = {
|
||||
_id: "tg_bot_update:" + data.update_id.toString(),
|
||||
type: "tg_bot_update",
|
||||
data: data,
|
||||
created_at: new Date().toISOString(),
|
||||
};
|
||||
return [doc, "Message saved"];
|
||||
};
|
||||
exports.saveUpdate = saveUpdate;
|
||||
exports.saveUpdateString = exports.saveUpdate.toString();
|
||||
//# sourceMappingURL=saveUpdate.js.map
|
||||
Reference in New Issue
Block a user