Skip to content

Commit 640b2ac

Browse files
committed
fix: /help (and /ping /stats) in DM send plain text, not HTML
The help text has literal <包名>/<编号> placeholders; sending it in HTML parse mode made Telegram reject the message ("can't parse entities: Unsupported start tag"), and the discarded send error meant /help produced no output in a private chat. Send these member commands as plain text in DM, matching the group path (notify). Verified via the live API.
1 parent 8eb0b8f commit 640b2ac

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

admin.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,10 @@ func (v *Verifier) onHelp(ctx *th.Context, update telego.Update) error {
141141
return nil
142142
}
143143
help += "\n\n(以上查询命令私聊也能用,每分钟限次;审核/管理命令仅在群里有效。)"
144-
_, _ = bot.SendMessage(c, htmlMessage(chatID, help))
144+
// Plain text (no HTML parse mode): the help lists literal <包名> placeholders that would
145+
// otherwise be misread as HTML tags and rejected by Telegram. The group path uses notify,
146+
// which is also plain.
147+
_, _ = bot.SendMessage(c, tu.Message(tu.ID(chatID), help))
145148
return nil
146149
}
147150

@@ -160,7 +163,7 @@ func (v *Verifier) memberCmd(ctx *th.Context, update telego.Update, fn func() st
160163
v.notify(c, bot, msg.Chat.ID, fn())
161164
return nil
162165
}
163-
_, _ = bot.SendMessage(c, htmlMessage(msg.Chat.ID, fn())) // DM: reply plainly, no delete
166+
_, _ = bot.SendMessage(c, tu.Message(tu.ID(msg.Chat.ID), fn())) // DM: reply as plain text, no delete
164167
return nil
165168
}
166169

0 commit comments

Comments
 (0)