Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Commit

Permalink
Added /report to /help command. Fixed else if
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexDyakonov committed Aug 18, 2024
1 parent 0f63f9b commit d9adfa6
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions routes/dashBot.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ router.post(`/hook`, (req, res) => {

if (reportMode) {
reportMode = false;

if (report_chat_id === undefined) {
console.log("`report_chat_id` is undefined. Chech envs to turn on reports.")
console.log("`report_chat_id` is undefined. Check envs to turn on reports.");
} else {
let reportTime = new Date().toLocaleString();

sendMessage(
{
chat_id: reportChatId,
Expand All @@ -96,7 +96,7 @@ router.post(`/hook`, (req, res) => {
'sendMessage',
token
);

sendMessage(
{
chat_id: chat_id,
Expand All @@ -106,9 +106,7 @@ router.post(`/hook`, (req, res) => {
token
);
}
}

if (text === '/start') {
} else if (text === '/start') {
let fullName = message.from.first_name;
if (message.from.last_name) {
fullName += ` ${message.from.last_name}`;
Expand All @@ -127,13 +125,13 @@ router.post(`/hook`, (req, res) => {
sendMessage(
{
chat_id: chat_id,
text: 'Доступные команды:\n/start - Запуск бота\n/help - Справка',
text: 'Доступные команды:\n/start - Запуск бота\n/help - Справка\n/report - сообщить о баге/проблеме',
},
'sendMessage',
token
);
} else if (text === '/report') {
reportMode = true; // Включаем режим репорта
reportMode = true;
sendMessage(
{
chat_id: chat_id,
Expand All @@ -142,9 +140,8 @@ router.post(`/hook`, (req, res) => {
'sendMessage',
token
);
return; // Завершаем обработку, чтобы не продолжать дальше
return;
} else {
// Если включен режим репорта, пересылаем сообщение
sendMessage(
{
chat_id: chat_id,
Expand Down

0 comments on commit d9adfa6

Please sign in to comment.