Open AmarnathCJD opened 3 weeks ago
d, err := client.GetDialogs(&tg.DialogOptions{
Limit: 500,
})
for _, v := range d {
switch dx := v.(type) {
case *tg.DialogObj:
peer, err := client.GetSendablePeer(dx.Peer)
if err != nil {
client.Logger.Error(err)
continue
}
switch peer.(type) {
case *tg.InputPeerChannel:
channel, _ := client.GetChannel(peer.(*tg.InputPeerChannel).ChannelID)
client.Logger.Info(fmt.Sprintf("Channel: %s", channel.Title))
case *tg.InputPeerChat:
chat, _ := client.GetChat(peer.(*tg.InputPeerChat).ChatID)
client.Logger.Info(fmt.Sprintf("Chat: %s", chat.Title))
}
}
}