You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, can i get the chat or channel id and name by using tg.Entities or by using UpdateNewChannelMessage?
To get private channel id i use this:
dispatcher.OnNewChannelMessage(func(ctx context.Context, e tg.Entities, update *tg.UpdateNewChannelMessage) error {
msg, ok := update.Message.(*tg.Message)
if !ok {
return nil
}
var re = regexp.MustCompile(`(?m)(\d+)`)
var val string
for i, match := range re.FindAllString(msg.PeerID.String(), -1) {
val = match
}
return nil
})
But in examples i can't find how to get channel id for public channels. And my second question, is it possible to get dispatcher.OnNewChannelMessage works with selected chats like in telethon ? @tclient.on(events.NewMessage(chats=chats))
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello, can i get the chat or channel id and name by using tg.Entities or by using UpdateNewChannelMessage?
To get private channel id i use this:
But in examples i can't find how to get channel id for public channels. And my second question, is it possible to get dispatcher.OnNewChannelMessage works with selected chats like in telethon ?
@tclient.on(events.NewMessage(chats=chats))
Beta Was this translation helpful? Give feedback.
All reactions