diff --git a/bot.go b/bot.go index 379737d..0305b5c 100644 --- a/bot.go +++ b/bot.go @@ -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