This commit is contained in:
shoopea 2020-02-01 20:02:02 +08:00
parent 48cc10b052
commit 29fdfc0640

32
bot.go
View File

@ -23,6 +23,8 @@ func BotHandlers(b *tb.Bot) {
b.Handle("/test", botTest)
b.Handle("/test_delay", botTestDelay)
b.Handle("/test_html", botTestHTML)
b.Handle("/test_user", botTestUser)
b.Handle("/msg_rescan", botMsgRescan)
b.Handle("/msg_rescan_all", botMsgRescanAll)
b.Handle("/msg_dump", botMsgDump)
@ -171,6 +173,36 @@ func botHelp(m *tb.Message) {
return
}
func botTestUser(m *tb.Message) {
if !m.Private() {
return
}
c, err := bot.ChatByID(m.Payload)
if err != nil {
c := TGCommand{
Type: commandReplyMsg,
Text: fmt.Sprintf("%s", err),
FromMsgID64: int64(m.ID),
FromChatID64: m.Chat.ID,
ParseMode: cmdParseModeHTML,
}
TGCmdQueue <- c
} else {
c := TGCommand{
Type: commandReplyMsg,
Text: c.Username,
FromMsgID64: int64(m.ID),
FromChatID64: m.Chat.ID,
ParseMode: cmdParseModeHTML,
}
TGCmdQueue <- c
}
return
}
func botTestHTML(m *tb.Message) {
if !m.Private() {
return