some code cleanup
This commit is contained in:
@@ -12,8 +12,7 @@ import {
|
|||||||
getUserAvatar,
|
getUserAvatar,
|
||||||
logError,
|
logError,
|
||||||
makeDarkGradientBgFancy,
|
makeDarkGradientBgFancy,
|
||||||
oldReplyToMessage,
|
replyToMessage
|
||||||
oldSendMessage
|
|
||||||
} from "../util/utils";
|
} from "../util/utils";
|
||||||
import {Requirements} from "../base/requirements";
|
import {Requirements} from "../base/requirements";
|
||||||
import {Requirement} from "../base/requirement";
|
import {Requirement} from "../base/requirement";
|
||||||
@@ -50,15 +49,10 @@ export class Quote extends Command {
|
|||||||
const chatId = msg.chat.id;
|
const chatId = msg.chat.id;
|
||||||
const reply = msg.reply_to_message;
|
const reply = msg.reply_to_message;
|
||||||
|
|
||||||
if (!reply) {
|
|
||||||
await oldReplyToMessage(msg, "Сделай /quote реплаем на сообщение 🙂").catch(logError);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const quoteRaw = (msg.quote?.text ?? reply.text ?? reply.caption ?? "").trim();
|
const quoteRaw = (msg.quote?.text ?? reply.text ?? reply.caption ?? "").trim();
|
||||||
if (quoteRaw.length === 0) {
|
if (quoteRaw.length === 0) {
|
||||||
await oldReplyToMessage(msg, "Не нашёл в сообщении текста 😢").catch(logError);
|
await replyToMessage({message: msg, text: "Не нашёл в сообщении текста 😢"}).catch(logError);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +70,7 @@ export class Quote extends Command {
|
|||||||
}).catch(logError);
|
}).catch(logError);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logError(e);
|
logError(e);
|
||||||
await oldSendMessage(msg, "Не смог собрать цитату 😢").catch(logError);
|
await replyToMessage({message: msg, text: "Не смог собрать цитату 😢"}).catch(logError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1149,7 +1149,7 @@ export async function processNewMessage(msg: Message): Promise<void> {
|
|||||||
logError(e);
|
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);
|
await bot.sendMessage({chat_id: msg.chat.id, text: randomValue(Environment.ANSWERS.invite)}).catch(logError);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user