1725 功能大改
This commit is contained in:
1 parent
fa52190830
commit
f73bf33bce
10 files changed
+1743
-10
No files matched your search
@@ -79,18 +79,21 @@ export async function startPolling(): Promise<void> {
|
||||
const chatId = msg.chat.id;
|
||||
if (!allowed(chatId)) continue;
|
||||
|
||||
// 处理语音消息(转文字写入文章)
|
||||
if ((msg.voice || msg.audio) && hasSession(chatId)) {
|
||||
const voiceFile = msg.voice || msg.audio;
|
||||
if (voiceFile) {
|
||||
await handleVoice(chatId, voiceFile.file_id);
|
||||
}
|
||||
// 处理语音消息(增强版:保存文件 + 转文字 + 生成短代码)
|
||||
if (msg.voice && hasSession(chatId)) {
|
||||
await handleVoiceEnhanced(chatId, msg.voice.file_id, msg.voice.duration);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 处理图片
|
||||
// 处理音频文件(增强版:支持封面图)
|
||||
if (msg.audio && hasSession(chatId)) {
|
||||
await handleAudioEnhanced(chatId, msg.audio.file_id, msg.audio.file_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 处理图片(增强版:支持封面图上传 + 实况照片引导)
|
||||
if (msg.photo && hasSession(chatId)) {
|
||||
await handlePhoto(chatId, msg.photo, msg.caption);
|
||||
await handlePhotoEnhanced(chatId, msg.photo, msg.caption);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -110,6 +113,13 @@ export async function startPolling(): Promise<void> {
|
||||
// ForceReply routing
|
||||
if (msg.reply_to_message?.text) {
|
||||
const original = msg.reply_to_message.text;
|
||||
|
||||
// 处理音频信息回复(音乐卡片)
|
||||
if (original.includes("请输入歌曲信息")) {
|
||||
const handled = await handleAudioInfo(chatId, fullText);
|
||||
if (handled) continue;
|
||||
}
|
||||
|
||||
if (original.includes("请输入文章标题")) { await handleCommand(chatId, "new", fullText); continue; }
|
||||
if (original.includes("请输入新标题")) { await handleCommand(chatId, "title", fullText); continue; }
|
||||
if (original.includes("请输入分类")) { await handleCommand(chatId, "categories", fullText); continue; }
|
||||
@@ -351,6 +361,13 @@ async function handleCommand(chatId: number, cmd: string, arg?: string) {
|
||||
}
|
||||
|
||||
async function handleInlineCallback(chatId: number, queryId: string, data: string) {
|
||||
// 处理音频封面图回调
|
||||
if (data === "audio_add_cover" || data === "audio_skip_cover") {
|
||||
await handleAudioCoverCallback(chatId, data);
|
||||
try { await tg("answerCallbackQuery", { callback_query_id: queryId }); } catch (_e) {}
|
||||
return;
|
||||
}
|
||||
|
||||
let prefix = "";
|
||||
let arg = "";
|
||||
// First try prefix match (e.g. "edit_slug", "list_2")
|
||||
@@ -373,3 +390,391 @@ async function handleInlineCallback(chatId: number, queryId: string, data: strin
|
||||
await handleCommand(chatId, cmd, arg);
|
||||
try { await tg("answerCallbackQuery", { callback_query_id: queryId }); } catch (_e) {}
|
||||
}
|
||||
| ||||