bump libs

migrate to typescript 6
remove ytdl feature
This commit is contained in:
2026-05-01 07:05:17 +03:00
parent ac51702f00
commit 13b41c3026
56 changed files with 1069 additions and 1857 deletions
+2 -2
View File
@@ -3,7 +3,7 @@ import {CallbackCommand} from "../base/callback-command";
export class Cancel extends CallbackCommand {
text = "❌ Отменить";
data = null;
data = "";
constructor(text?: string, data?: string) {
super();
@@ -13,7 +13,7 @@ export class Cancel extends CallbackCommand {
}
static withData(data?: string): Cancel {
return new Cancel(null, data);
return new Cancel("", data);
}
async execute(): Promise<void> {
@@ -1,36 +0,0 @@
import {CallbackCommand} from "../base/callback-command";
import {CallbackQuery} from "typescript-telegram-bot-api";
import {Requirements} from "../base/requirements";
import {Requirement} from "../base/requirement";
import {commands} from "../index";
import {YouTubeDownload} from "../commands/youtube-download";
const downloadText = " 📥 Скачать";
const getFromCacheText = "📥 Загрузить из кэша";
export class DownloadYtVideo extends CallbackCommand {
data = "/ytdl";
text = " 📥 Скачать";
requirements = Requirements.Build(Requirement.SAME_USER);
constructor(text?: string, data?: string) {
super();
this.text = text || this.text;
this.data = data || this.data;
}
static withData(inCache?: boolean, data?: string): DownloadYtVideo {
return new DownloadYtVideo(inCache ? getFromCacheText : downloadText, data);
}
async execute(query: CallbackQuery): Promise<void> {
const videoId = query.data.split(" ")[1];
if (!videoId) return;
const yt = commands.find(c => c instanceof YouTubeDownload);
if (!yt) return;
await yt.downloadYouTubeVideo(query.message, {videoId: videoId});
}
}
+3 -1
View File
@@ -16,6 +16,8 @@ export class OllamaCancel extends CallbackCommand {
requirements = Requirements.Build(Requirement.SAME_USER);
async execute(query: CallbackQuery): Promise<void> {
if (!query.message || !query.data) return;
const chatId = query.message.chat.id;
const fromId = query.from.id;
const messageId = query.message.message_id;
@@ -44,7 +46,7 @@ export class OllamaCancel extends CallbackCommand {
let content: string | null = null;
if (msg?.text?.trim()?.length > 0) {
if (msg?.text?.trim()?.length) {
content = msg?.text.trim();
if (content.length + Environment.ollamaCancelledText.length > 4096) {
content = content.substring(0, 4096 - Environment.ollamaCancelledText.length - 2) + "\n";
+1 -1
View File
@@ -12,7 +12,7 @@ export class TryAgain extends CallbackCommand {
}
static withData(data?: string): TryAgain {
return new TryAgain(null, data);
return new TryAgain("", data);
}
async execute(): Promise<void> {
-15
View File
@@ -1,15 +0,0 @@
import {CallbackCommand} from "../base/callback-command";
import {CallbackQuery} from "typescript-telegram-bot-api";
import {processYouTubeLink} from "../util/utils";
export class YtInfo extends CallbackCommand {
data = "/ytinfo";
text: string;
async execute(query: CallbackQuery): Promise<void> {
const videoId = query.data.split(" ")[1];
if (!videoId) return;
await processYouTubeLink(query.message, null, videoId);
}
}