Small updates. Readme updated
parent
2a5cf8652d
commit
5859ba3970
|
@ -35,9 +35,9 @@ func main() {
|
|||
u := tgbotapi.NewUpdate(0)
|
||||
u.Timeout = 60
|
||||
|
||||
err = bot.UpdatesChan(u)
|
||||
updates, err := bot.GetUpdatesChan(u)
|
||||
|
||||
for update := range bot.Updates {
|
||||
for update := range updates {
|
||||
log.Printf("[%s] %s", update.Message.From.UserName, update.Message.Text)
|
||||
|
||||
msg := tgbotapi.NewMessage(update.Message.Chat.ID, update.Message.Text)
|
||||
|
@ -74,10 +74,10 @@ func main() {
|
|||
log.Fatal(err)
|
||||
}
|
||||
|
||||
bot.ListenForWebhook("/"+bot.Token)
|
||||
updates, _ := bot.ListenForWebhook("/" + bot.Token)
|
||||
go http.ListenAndServeTLS("0.0.0.0:8443", "cert.pem", "key.pem", nil)
|
||||
|
||||
for update := range bot.Updates {
|
||||
for update := range updates {
|
||||
log.Printf("%+v\n", update)
|
||||
}
|
||||
}
|
||||
|
|
2
bot.go
2
bot.go
|
@ -394,7 +394,7 @@ func (bot *BotAPI) SetWebhook(config WebhookConfig) (APIResponse, error) {
|
|||
}
|
||||
|
||||
// UpdatesChan starts a channel for getting updates.
|
||||
func (bot *BotAPI) UpdatesChan(config UpdateConfig) (<-chan Update, error) {
|
||||
func (bot *BotAPI) GetUpdatesChan(config UpdateConfig) (<-chan Update, error) {
|
||||
updatesChan := make(chan Update, 100)
|
||||
|
||||
go func() {
|
||||
|
|
|
@ -396,7 +396,7 @@ func TestUpdatesChan(t *testing.T) {
|
|||
|
||||
var ucfg tgbotapi.UpdateConfig = tgbotapi.NewUpdate(0)
|
||||
ucfg.Timeout = 60
|
||||
_, err := bot.UpdatesChan(ucfg)
|
||||
_, err := bot.GetUpdatesChan(ucfg)
|
||||
|
||||
if err != nil {
|
||||
t.Fail()
|
||||
|
@ -416,7 +416,7 @@ func ExampleNewBotAPI() {
|
|||
u := tgbotapi.NewUpdate(0)
|
||||
u.Timeout = 60
|
||||
|
||||
updates, err := bot.UpdatesChan(u)
|
||||
updates, err := bot.GetUpdatesChan(u)
|
||||
|
||||
for update := range updates {
|
||||
log.Printf("[%s] %s", update.Message.From.UserName, update.Message.Text)
|
||||
|
|
Loading…
Reference in New Issue