优化私聊post
This commit is contained in:
11
README.md
11
README.md
@@ -80,14 +80,13 @@ toc:
|
||||
|
||||
## 投稿方式
|
||||
|
||||
### 方式一:交互式流程(私聊 Bot)
|
||||
### 方式一:私聊转发(推荐)
|
||||
|
||||
```
|
||||
1. 私聊 Bot 发送 /post
|
||||
2. 转发任意消息给 Bot(支持来自任意来源:个人、群组、频道等)
|
||||
3. 点击分类按钮
|
||||
4. 确认标题 (使用默认 / 自定义输入)
|
||||
5. 确认添加
|
||||
1. 私聊 Bot,直接转发任意消息(支持来自个人、群组、频道等)
|
||||
2. 点击分类按钮
|
||||
3. 确认标题 (使用默认 / 自定义输入)
|
||||
4. 确认添加
|
||||
```
|
||||
|
||||
Bot 会将消息内容复制发送到频道,目录链接指向频道中的新消息。
|
||||
|
||||
@@ -100,17 +100,21 @@ func (b *Bot) handleTextInput(c tele.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// 只处理有活跃投稿状态的用户
|
||||
// 检查是否为转发消息
|
||||
isForwarded := msg.OriginalChat != nil || msg.OriginalSender != nil
|
||||
|
||||
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)
|
||||
// OriginalChat: 转发自频道/群组; OriginalSender: 转发自个人用户
|
||||
isForwarded := msg.OriginalChat != nil || msg.OriginalSender != nil
|
||||
if isForwarded && state.Step == StepAwaitForward {
|
||||
return b.handleForwarded(c)
|
||||
if state == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// 自定义标题输入 (StepAwaitTitle)
|
||||
|
||||
Reference in New Issue
Block a user