feat(telegram): 移除评论删除功能,仅保留批准操作
- 移除 Telegram 通知中的“删除”按钮,仅保留“批准”按钮以简化审核流程 - 更新 Telegram webhook 回调处理,不再支持 delete 动作,并返回提示信息 - 同步更新相关文档,删除关于“删除”操作的描述 - 新增图标资源文件
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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, '当前仅支持审核操作');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Telegram 通知与交互
|
||||
|
||||
系统支持通过 Telegram 机器人接收新评论通知,并在 Telegram 中对评论进行批准或删除操作。
|
||||
系统支持通过 Telegram 机器人接收新评论通知,并在 Telegram 中对评论进行审核(批准)操作。
|
||||
|
||||
## 功能特性
|
||||
|
||||
1. **实时通知**:新评论会立即推送到指定的 Telegram 账号或群组。
|
||||
2. **快捷审核**:通知消息包含“批准”和“删除”按钮,无需登录后台即可审核。
|
||||
2. **快捷审核**:通知消息包含“批准”按钮,无需登录后台即可审核。
|
||||
|
||||
## 配置步骤
|
||||
|
||||
@@ -30,4 +30,4 @@
|
||||
|
||||
## 使用说明
|
||||
|
||||
- **审核**:点击消息下方的按钮即可(批准 / 删除)。
|
||||
- **审核**:在 Telegram 中点击消息下方的“批准”按钮即可完成审核操作。
|
||||
|
||||
BIN
docs/public/icon1.png
Normal file
BIN
docs/public/icon1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 188 KiB |
Reference in New Issue
Block a user