mirror of
https://github.com/42wim/matterbridge.git
synced 2024-11-24 11:42:03 -08:00
Add Telegram Bot Command /chatId (telegram) (#1703)
* feat(telegram): command to get chat id * Gofumpt Co-authored-by: Ivan Zuev <i-zuev@yandex-team.ru> Co-authored-by: Wim <wim@42.be>
This commit is contained in:
parent
6a7412bf2b
commit
4801850013
@ -1,6 +1,7 @@
|
|||||||
package btelegram
|
package btelegram
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"html"
|
"html"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -15,9 +16,21 @@ import (
|
|||||||
func (b *Btelegram) handleUpdate(rmsg *config.Message, message, posted, edited *tgbotapi.Message) *tgbotapi.Message {
|
func (b *Btelegram) handleUpdate(rmsg *config.Message, message, posted, edited *tgbotapi.Message) *tgbotapi.Message {
|
||||||
// handle channels
|
// handle channels
|
||||||
if posted != nil {
|
if posted != nil {
|
||||||
|
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
|
message = posted
|
||||||
rmsg.Text = message.Text
|
rmsg.Text = message.Text
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// edited channel message
|
// edited channel message
|
||||||
if edited != nil && !b.GetBool("EditDisable") {
|
if edited != nil && !b.GetBool("EditDisable") {
|
||||||
|
Loading…
Reference in New Issue
Block a user