Skip to content

Commit 290b936

Browse files
committed
Fix bot_test.go, update README.
1 parent afda722 commit 290b936

File tree

2 files changed

+3
-73
lines changed

2 files changed

+3
-73
lines changed

README.md

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -62,64 +62,7 @@ func main() {
6262
}
6363
```
6464

65-
There are more examples on the [wiki](https://github.com/go-telegram-bot-api/telegram-bot-api/wiki)
65+
There are more examples on the [site](https://go-telegram-bot-api.github.io/)
6666
with detailed information on how to do many different kinds of things.
6767
It's a great place to get started on using keyboards, commands, or other
6868
kinds of reply markup.
69-
70-
If you need to use webhooks (if you wish to run on Google App Engine),
71-
you may use a slightly different method.
72-
73-
```go
74-
package main
75-
76-
import (
77-
"log"
78-
"net/http"
79-
80-
"github.com/go-telegram-bot-api/telegram-bot-api"
81-
)
82-
83-
func main() {
84-
bot, err := tgbotapi.NewBotAPI("MyAwesomeBotToken")
85-
if err != nil {
86-
log.Fatal(err)
87-
}
88-
89-
bot.Debug = true
90-
91-
log.Printf("Authorized on account %s", bot.Self.UserName)
92-
93-
_, err = bot.Request(tgbotapi.NewWebhookWithCert("https://www.google.com:8443/"+bot.Token, "cert.pem"))
94-
if err != nil {
95-
log.Fatal(err)
96-
}
97-
98-
info, err := bot.GetWebhookInfo()
99-
100-
if err != nil {
101-
log.Fatal(err)
102-
}
103-
104-
if info.LastErrorDate != 0 {
105-
log.Printf("Telegram callback failed: %s", info.LastErrorMessage)
106-
}
107-
108-
updates := bot.ListenForWebhook("/" + bot.Token)
109-
go http.ListenAndServeTLS("0.0.0.0:8443", "cert.pem", "key.pem", nil)
110-
111-
for update := range updates {
112-
log.Printf("%+v\n", update)
113-
}
114-
}
115-
```
116-
117-
If you need, you may generate a self signed certficate, as this requires
118-
HTTPS / TLS. The above example tells Telegram that this is your
119-
certificate and that it should be trusted, even though it is not
120-
properly signed.
121-
122-
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 3560 -subj "//O=Org\CN=Test" -nodes
123-
124-
Now that [Let's Encrypt](https://letsencrypt.org) is available, you may
125-
wish to generate your free TLS certificate there.

bot_test.go

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -509,19 +509,6 @@ func TestSetWebhookWithoutCert(t *testing.T) {
509509
bot.Request(RemoveWebhookConfig{})
510510
}
511511

512-
func TestUpdatesChan(t *testing.T) {
513-
bot, _ := getBot(t)
514-
515-
var ucfg = NewUpdate(0)
516-
ucfg.Timeout = 60
517-
_, err := bot.GetUpdatesChan(ucfg)
518-
519-
if err != nil {
520-
t.Error(err)
521-
t.Fail()
522-
}
523-
}
524-
525512
func TestSendWithMediaGroup(t *testing.T) {
526513
bot, _ := getBot(t)
527514

@@ -549,7 +536,7 @@ func ExampleNewBotAPI() {
549536
u := NewUpdate(0)
550537
u.Timeout = 60
551538

552-
updates, err := bot.GetUpdatesChan(u)
539+
updates := bot.GetUpdatesChan(u)
553540

554541
// Optional: wait for updates and clear them if you don't want to handle
555542
// a large backlog of old messages
@@ -614,7 +601,7 @@ func ExampleInlineConfig() {
614601
u := NewUpdate(0)
615602
u.Timeout = 60
616603

617-
updates, err := bot.GetUpdatesChan(u)
604+
updates := bot.GetUpdatesChan(u)
618605

619606
for update := range updates {
620607
if update.InlineQuery == nil { // if no inline query, ignore it

0 commit comments

Comments
 (0)