Skip to content

Commit

Permalink
Merge pull request tucnak#115 from JackSpera/v2
Browse files Browse the repository at this point in the history
Fixed could not send message to private channel
  • Loading branch information
Ian Byrd authored Dec 30, 2017
2 parents 389bcd3 + 5513a66 commit c2b7ed0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 5 additions & 0 deletions bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
9 changes: 5 additions & 4 deletions telebot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c2b7ed0

Please sign in to comment.