How to get paticipaint in channel/group?
tiulinh opened this issue · 3 comments
tiulinh commented
How to get paticipaint in channel/group? please help me!
TeaDove commented
Something like this:
switch t := update.EffectiveChat().(type) {
case *types.Chat:
chat := r.telegramManager.Chat(t.Raw())
chatMembers := members.Chat(chat)
err := chatMembers.ForEach(ctx, compileMention)
if err != nil {
return err
}
case *types.Channel:
chat := r.telegramManager.Channel(t.Raw())
chatMembers := members.Channel(chat)
err := chatMembers.ForEach(ctx, compileMention)
if err != nil {
return err
}
default:
_, err := ctx.Reply(update, "Err: this command work only in chats", nil)
return err
}
You can find whole example here: https://github.com/TeaDove/fun-telegram/blob/feature/persistent-storage/internal/presentation/telegram/pingCommand.go#L14
tiulinh commented
Thank you so much!
tiulinh commented
Something like this:
switch t := update.EffectiveChat().(type) { case *types.Chat: chat := r.telegramManager.Chat(t.Raw()) chatMembers := members.Chat(chat) err := chatMembers.ForEach(ctx, compileMention) if err != nil { return err } case *types.Channel: chat := r.telegramManager.Channel(t.Raw()) chatMembers := members.Channel(chat) err := chatMembers.ForEach(ctx, compileMention) if err != nil { return err } default: _, err := ctx.Reply(update, "Err: this command work only in chats", nil) return err }You can find whole example here: https://github.com/TeaDove/fun-telegram/blob/feature/persistent-storage/internal/presentation/telegram/pingCommand.go#L14
are there any way get get paticipaint in channel/group with input: Username/ ID channel/group?