Skip to content

Commit 6b71d4d

Browse files
authored
Merge pull request #202 from go-telegram-bot-api/develop
Deduplicate code, improve response accuracy.
2 parents 54104a0 + 7c82078 commit 6b71d4d

30 files changed

+5566
-2776
lines changed

.github/workflows/test.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- develop
8+
pull_request:
9+
10+
jobs:
11+
build:
12+
name: Test
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Set up Go 1.x
16+
uses: actions/setup-go@v2
17+
with:
18+
go-version: ^1.15
19+
id: go
20+
21+
- name: Check out code into the Go module directory
22+
uses: actions/checkout@v2
23+
24+
- name: Build
25+
run: go build -v .
26+
27+
- name: Test
28+
run: go test -coverprofile=coverage.out -covermode=atomic -v .
29+
30+
- name: Upload coverage report
31+
uses: codecov/codecov-action@v1
32+
with:
33+
file: ./coverage.out

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.idea/
22
coverage.out
33
tmp/
4+
book/

.travis.yml

-6
This file was deleted.

README.md

+1-54
Original file line numberDiff line numberDiff line change
@@ -62,60 +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.SetWebhook(tgbotapi.NewWebhookWithCert("https://www.google.com:8443/"+bot.Token, "cert.pem"))
94-
if err != nil {
95-
log.Fatal(err)
96-
}
97-
info, err := bot.GetWebhookInfo()
98-
if err != nil {
99-
log.Fatal(err)
100-
}
101-
if info.LastErrorDate != 0 {
102-
log.Printf("Telegram callback failed: %s", info.LastErrorMessage)
103-
}
104-
updates := bot.ListenForWebhook("/" + bot.Token)
105-
go http.ListenAndServeTLS("0.0.0.0:8443", "cert.pem", "key.pem", nil)
106-
107-
for update := range updates {
108-
log.Printf("%+v\n", update)
109-
}
110-
}
111-
```
112-
113-
If you need, you may generate a self signed certficate, as this requires
114-
HTTPS / TLS. The above example tells Telegram that this is your
115-
certificate and that it should be trusted, even though it is not
116-
properly signed.
117-
118-
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 3560 -subj "//O=Org\CN=Test" -nodes
119-
120-
Now that [Let's Encrypt](https://letsencrypt.org) is available,
121-
you may wish to generate your free TLS certificate there.

book.toml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[book]
2+
authors = ["Syfaro"]
3+
language = "en"
4+
multilingual = false
5+
src = "docs"
6+
title = "Go Telegram Bot API"
7+
8+
[output.html]
9+
git-repository-url = "https://github.com/go-telegram-bot-api/telegram-bot-api"

0 commit comments

Comments
 (0)