bump libs
migrate to typescript 6 remove ytdl feature
This commit is contained in:
@@ -67,7 +67,7 @@ export class Environment {
|
||||
static ollamaCancelledText = "```Ollama\n❌ Отменено```";
|
||||
|
||||
static load() {
|
||||
Environment.BOT_TOKEN = process.env.BOT_TOKEN;
|
||||
Environment.BOT_TOKEN = <string>process.env.BOT_TOKEN;
|
||||
Environment.TEST_ENVIRONMENT = ifTrue(process.env.TEST_ENVIRONMENT);
|
||||
Environment.CHAT_IDS_WHITELIST = new Set(process.env.CHAT_IDS_WHITELIST?.split(",")?.map(e => parseInt(e.trim(), 10)) || []);
|
||||
Environment.BOT_PREFIX = process.env.BOT_PREFIX || "";
|
||||
|
||||
@@ -15,14 +15,16 @@ export class MessageStore {
|
||||
}
|
||||
|
||||
static async put(m: Message | StoredMessage): Promise<StoredMessage> {
|
||||
const maxSizePath = isStoredMessage(m) ? null : getPhotoMaxSize(m.photo)?.file_unique_id;
|
||||
|
||||
const msg: StoredMessage = isStoredMessage(m) ? m : {
|
||||
chatId: m.chat.id,
|
||||
id: m.message_id,
|
||||
replyToMessageId: m.reply_to_message?.message_id ?? null,
|
||||
fromId: m.from.id,
|
||||
replyToMessageId: m.reply_to_message?.message_id,
|
||||
fromId: <number>m.from?.id,
|
||||
text: extractTextMessage(m),
|
||||
date: m.date ?? 0,
|
||||
photoMaxSizeFilePath: m.photo ? [getPhotoMaxSize(m.photo).file_unique_id] : null
|
||||
photoMaxSizeFilePath: maxSizePath ? [maxSizePath] : undefined,
|
||||
};
|
||||
|
||||
this.map.set(this.key(msg.chatId, msg.id), msg);
|
||||
@@ -30,7 +32,9 @@ export class MessageStore {
|
||||
return msg;
|
||||
}
|
||||
|
||||
static async get(chatId: number, messageId: number): Promise<StoredMessage | null> {
|
||||
static async get(chatId: number, messageId: number | undefined): Promise<StoredMessage | null> {
|
||||
if (!messageId) return null;
|
||||
|
||||
const message = await messageDao.getById({chatId: chatId, id: messageId});
|
||||
if (!message) return null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user