commit dff72a102013dad08581eb0dd50819f4085057cc
Author: Ivan Zuev <dajohnes@gmail.com>
Date: Thu Feb 03 02:20:25 2022 +0000
diff --git a/bridge/telegram/handlers.go b/bridge/telegram/handlers.go
index 80a7185..8461df3 100644
--- a/bridge/telegram/handlers.go
+++ b/bridge/telegram/handlers.go
@@ -16 +17 @@
package btelegram
import (
+ "fmt"
"html"
"path/filepath"
"strconv"
@@ -158 +1620 @@ import (
func (b *Btelegram) handleUpdate(rmsg *config.Message, message, posted, edited *tgbotapi.Message) *tgbotapi.Message {
// handle channels
if posted != nil {
- message = posted
- rmsg.Text = message.Text
+ if posted.Text == "/chatId" {
+ chatID := strconv.FormatInt(posted.Chat.ID, 10)
+
+ _, err := b.Send(config.Message{
+ Channel: chatID,
+ Text: fmt.Sprintf("ID of this chat: %s", chatID),
+ })
+ if err != nil {
+ b.Log.Warnf("Unable to send chatID to %s", chatID)
+ }
+ } else {
+ message = posted
+ rmsg.Text = message.Text
+ }
}
// edited channel message