优化私聊post

This commit is contained in:
dela
2026-02-05 10:40:17 +08:00
parent 3fea0ee89c
commit ee9418b7cf
2 changed files with 17 additions and 14 deletions

View File

@@ -80,14 +80,13 @@ toc:
## 投稿方式 ## 投稿方式
### 方式一:交互式流程(私聊 Bot ### 方式一:私聊转发(推荐
``` ```
1. 私聊 Bot 发送 /post 1. 私聊 Bot,直接转发任意消息(支持来自个人、群组、频道等)
2. 转发任意消息给 Bot支持来自任意来源个人、群组、频道等 2. 点击分类按钮
3. 点击分类按钮 3. 确认标题 (使用默认 / 自定义输入)
4. 确认标题 (使用默认 / 自定义输入) 4. 确认添加
5. 确认添加
``` ```
Bot 会将消息内容复制发送到频道,目录链接指向频道中的新消息。 Bot 会将消息内容复制发送到频道,目录链接指向频道中的新消息。

View File

@@ -100,17 +100,21 @@ func (b *Bot) handleTextInput(c tele.Context) error {
return nil return nil
} }
// 只处理有活跃投稿状态的用户 // 检查是否为转发消息
isForwarded := msg.OriginalChat != nil || msg.OriginalSender != nil
state := b.states.Get(c.Sender().ID) state := b.states.Get(c.Sender().ID)
if state == nil {
return nil // 私聊收到转发消息,直接启动投稿流程(无需先 /post
if isForwarded && b.cfg.IsAdmin(c.Sender().ID) {
if state == nil || state.Step == StepAwaitForward {
b.states.StartPost(c.Sender().ID)
return b.handleForwarded(c)
}
} }
// 转发消息处理 (StepAwaitForward) if state == nil {
// OriginalChat: 转发自频道/群组; OriginalSender: 转发自个人用户 return nil
isForwarded := msg.OriginalChat != nil || msg.OriginalSender != nil
if isForwarded && state.Step == StepAwaitForward {
return b.handleForwarded(c)
} }
// 自定义标题输入 (StepAwaitTitle) // 自定义标题输入 (StepAwaitTitle)