diff --git a/cwd-api/src/api/public/postComment.ts b/cwd-api/src/api/public/postComment.ts index 57f02c3..efccce3 100644 --- a/cwd-api/src/api/public/postComment.ts +++ b/cwd-api/src/api/public/postComment.ts @@ -267,9 +267,6 @@ export const postComment = async (c: Context<{ Bindings: Bindings }>) => { if (defaultStatus === 'pending') { buttons.push({ text: "批准", callback_data: `approve:${commentId}` }); - buttons.push({ text: "删除", callback_data: `delete:${commentId}` }); - } else { - buttons.push({ text: "删除", callback_data: `delete:${commentId}` }); } const message = ` @@ -283,11 +280,14 @@ ${contentText} #ID:${commentId} `.trim(); - await sendTelegramMessage(tgSettings.botToken, tgSettings.chatId, message, { - reply_markup: { + const options: any = {}; + if (buttons.length > 0) { + options.reply_markup = { inline_keyboard: [buttons] - } - }); + }; + } + + await sendTelegramMessage(tgSettings.botToken, tgSettings.chatId, message, options); } } catch (tgError) { console.error('Telegram Notification Failed:', tgError); diff --git a/cwd-api/src/api/telegram/webhook.ts b/cwd-api/src/api/telegram/webhook.ts index f3ebbb8..83ac987 100644 --- a/cwd-api/src/api/telegram/webhook.ts +++ b/cwd-api/src/api/telegram/webhook.ts @@ -44,11 +44,7 @@ async function handleCallbackQuery(c: Context<{ Bindings: Bindings }>, token: st const newText = message.text + '\n\n✅ 已批准 (Approved)'; await editMessageText(token, chatId, messageId, newText); await answerCallbackQuery(token, id, '评论已批准'); - } else if (action === 'delete') { - await c.env.CWD_DB.prepare('DELETE FROM Comment WHERE id = ?').bind(commentId).run(); - - const newText = message.text + '\n\n🗑️ 已删除 (Deleted)'; - await editMessageText(token, chatId, messageId, newText); - await answerCallbackQuery(token, id, '评论已删除'); + } else { + await answerCallbackQuery(token, id, '当前仅支持审核操作'); } } diff --git a/docs/function/telegram-notify.md b/docs/function/telegram-notify.md index 7a35b0a..2196816 100644 --- a/docs/function/telegram-notify.md +++ b/docs/function/telegram-notify.md @@ -1,11 +1,11 @@ # Telegram 通知与交互 -系统支持通过 Telegram 机器人接收新评论通知,并在 Telegram 中对评论进行批准或删除操作。 +系统支持通过 Telegram 机器人接收新评论通知,并在 Telegram 中对评论进行审核(批准)操作。 ## 功能特性 1. **实时通知**:新评论会立即推送到指定的 Telegram 账号或群组。 -2. **快捷审核**:通知消息包含“批准”和“删除”按钮,无需登录后台即可审核。 +2. **快捷审核**:通知消息包含“批准”按钮,无需登录后台即可审核。 ## 配置步骤 @@ -30,4 +30,4 @@ ## 使用说明 -- **审核**:点击消息下方的按钮即可(批准 / 删除)。 +- **审核**:在 Telegram 中点击消息下方的“批准”按钮即可完成审核操作。 diff --git a/docs/public/icon1.png b/docs/public/icon1.png new file mode 100644 index 0000000..278701e Binary files /dev/null and b/docs/public/icon1.png differ