Closed ejamesc closed 6 years ago
Ahh, my bad. After reading through your code, I realise that the key to getting supergroup id is to cast Chat.Type
to SupergroupChatType
. Sorry about this.
No problem ;)
I seem to be having the same issue here but can't solve it, how did you do it?
Edit: I seem to have figured it out rather quick
newSecretChat, err := tg.client.CreateNewSecretChat(_ID_)
// handle err
secretChat:= newSecretChat.Type.(*tdlib.ChatTypeSecret)
fmt.Println(secretChat.SecretChatID)
@nathan0 if you have a Chat
that is a supergroup, you may cast the property Chat.Type
to the type ChatTypeSupergroupType
.
This code snippet should give you an idea:
for i, chat := range chatList {
if chat.Type.GetChatTypeEnum() == tdlib.ChatTypeSupergroupType {
spChat, ok := chat.Type.(*tdlib.ChatTypeSupergroup)
// handle ok
fmt.Println(spChat.SupergroupID)
}
}
Given I am a user of this library, When I get an ID of a recent supergroup, the ID is int64 — 1001209913598, for instance. If I try to get information on this supergroup, Then this example ID will overflow int32.
This happens because the function GetSupergroup takes in int32 as a param:
func (client *Client) GetSupergroup(supergroupID int32) (*Supergroup, error)
I'm not sure if I'm missing something here. Could we change the function signatures to become int64? I could create a PR with that, if you'd like.