Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ func (bot *BotAPI) SetAPIEndpoint(apiEndpoint string) {
bot.apiEndpoint = apiEndpoint
}

// SetAPIEndpoint changes the Telegram Bot API update chan buffer used by the instance.
func (bot *BotAPI) SetUpdatesBuffer(capacity int) {
bot.Buffer = capacity
}

func buildParams(in Params) url.Values {
if in == nil {
return url.Values{}
Expand Down
9 changes: 9 additions & 0 deletions bot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ func getBot(t *testing.T) (*BotAPI, error) {
return bot, err
}

func TestBotWithCustomBuffer(t *testing.T) {
bot, _ := getBot(t)

customValue := 200
bot.SetUpdatesBuffer(customValue)

assertEq(t, bot.Buffer, customValue)
}

func TestNewBotAPI_notoken(t *testing.T) {
_, err := NewBotAPI("")

Expand Down