Put Telegram login timer first in button
All checks were successful
Build and deploy Backend / build (push) Successful in 37s
All checks were successful
Build and deploy Backend / build (push) Successful in 37s
This commit is contained in:
@@ -124,12 +124,12 @@ function formatRemaining(expiresAt: Date) {
|
|||||||
return `${minutes}:${rest}`;
|
return `${minutes}:${rest}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function loginReplyMarkup(token: string) {
|
function loginReplyMarkup(token: string, expiresAt: Date) {
|
||||||
return {
|
return {
|
||||||
inline_keyboard: [
|
inline_keyboard: [
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
text: 'Войти',
|
text: `${formatRemaining(expiresAt)} Войти`,
|
||||||
url: `${config.webAppUrl}?telegram_login=${encodeURIComponent(token)}`,
|
url: `${config.webAppUrl}?telegram_login=${encodeURIComponent(token)}`,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -138,7 +138,7 @@ function loginReplyMarkup(token: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function loginMessageText(expiresAt: Date) {
|
function loginMessageText(expiresAt: Date) {
|
||||||
return [formatRemaining(expiresAt), '', 'Войти в MapFlow'].join('\n');
|
return 'Войти в MapFlow';
|
||||||
}
|
}
|
||||||
|
|
||||||
async function sendLoginMessage(
|
async function sendLoginMessage(
|
||||||
@@ -147,7 +147,7 @@ async function sendLoginMessage(
|
|||||||
token?: string,
|
token?: string,
|
||||||
expiresAt?: Date,
|
expiresAt?: Date,
|
||||||
) {
|
) {
|
||||||
const replyMarkup = token && expiresAt ? loginReplyMarkup(token) : undefined;
|
const replyMarkup = token && expiresAt ? loginReplyMarkup(token, expiresAt) : undefined;
|
||||||
|
|
||||||
return callTelegram<TelegramSentMessage>('sendMessage', {
|
return callTelegram<TelegramSentMessage>('sendMessage', {
|
||||||
chat_id: chatId,
|
chat_id: chatId,
|
||||||
|
|||||||
Reference in New Issue
Block a user