some code cleanup

This commit is contained in:
2026-02-16 19:52:28 +03:00
parent b8b3895310
commit 8bec34413f
2 changed files with 4 additions and 10 deletions
+3 -9
View File
@@ -12,8 +12,7 @@ import {
getUserAvatar,
logError,
makeDarkGradientBgFancy,
oldReplyToMessage,
oldSendMessage
replyToMessage
} from "../util/utils";
import {Requirements} from "../base/requirements";
import {Requirement} from "../base/requirement";
@@ -50,15 +49,10 @@ export class Quote extends Command {
const chatId = msg.chat.id;
const reply = msg.reply_to_message;
if (!reply) {
await oldReplyToMessage(msg, "Сделай /quote реплаем на сообщение 🙂").catch(logError);
return;
}
try {
const quoteRaw = (msg.quote?.text ?? reply.text ?? reply.caption ?? "").trim();
if (quoteRaw.length === 0) {
await oldReplyToMessage(msg, "Не нашёл в сообщении текста 😢").catch(logError);
await replyToMessage({message: msg, text: "Не нашёл в сообщении текста 😢"}).catch(logError);
return;
}
@@ -76,7 +70,7 @@ export class Quote extends Command {
}).catch(logError);
} catch (e) {
logError(e);
await oldSendMessage(msg, "Не смог собрать цитату 😢").catch(logError);
await replyToMessage({message: msg, text: "Не смог собрать цитату 😢"}).catch(logError);
}
}
}
+1 -1
View File
@@ -1149,7 +1149,7 @@ export async function processNewMessage(msg: Message): Promise<void> {
logError(e);
}
if ((msg.new_chat_members?.length || 0 > 0)) {
if ((msg.new_chat_members?.length)) {
await bot.sendMessage({chat_id: msg.chat.id, text: randomValue(Environment.ANSWERS.invite)}).catch(logError);
return;
}