Fixed could not send message to private channel

pull/115/head
Giovanni Spera 7 years ago
parent 389bcd3e65
commit 5513a66463

@ -1046,6 +1046,11 @@ func (b *Bot) ChatByID(id string) (*Chat, error) {
return nil, errors.Errorf("api error: %s", resp.Description)
}
if resp.Result.Type == ChatChannel && resp.Result.Username != "" {
//Channel is Private
resp.Result.Type = ChatChannelPrivate
}
return resp.Result, nil
}

@ -128,10 +128,11 @@ const (
type ChatType string
const (
ChatPrivate ChatType = "private"
ChatGroup ChatType = "group"
ChatSuperGroup ChatType = "supergroup"
ChatChannel ChatType = "channel"
ChatPrivate ChatType = "private"
ChatGroup ChatType = "group"
ChatSuperGroup ChatType = "supergroup"
ChatChannel ChatType = "channel"
ChatChannelPrivate ChatType = "privatechannel"
)
// MemberStatus is one's chat status

Loading…
Cancel
Save