Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hi, there not really PR, but new vision of tgbotapi with new API #29

Merged
merged 33 commits into from
Nov 22, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
13a8bd0
Refactorings
zhulik Nov 20, 2015
57a07c0
Refactoring and DRYing
zhulik Nov 20, 2015
4610c56
Drying
zhulik Nov 20, 2015
92ce2aa
Refactoring, drying
zhulik Nov 20, 2015
d8ba9c8
Refactoring
zhulik Nov 20, 2015
54b9c7e
Refactoring
zhulik Nov 20, 2015
9361631
Refactoring
zhulik Nov 20, 2015
d3f7ac7
Refactorings
zhulik Nov 20, 2015
da026b4
Totally new, universal API
zhulik Nov 20, 2015
d071173
Test added, small improvements
zhulik Nov 20, 2015
e16094f
Tests improved
zhulik Nov 20, 2015
a192540
Many tests added. Small fixes
zhulik Nov 20, 2015
c67df95
Tests added
zhulik Nov 21, 2015
53dd9f6
Fixes, tests improved
zhulik Nov 21, 2015
9644984
removeWebhook method added.
zhulik Nov 21, 2015
207a1a0
Tests added
zhulik Nov 21, 2015
c4515aa
Small fixes
zhulik Nov 21, 2015
45c6054
Readme updated
zhulik Nov 21, 2015
0189909
Readme update
zhulik Nov 21, 2015
b8bc7b9
Test example added
zhulik Nov 21, 2015
4471154
Travis added
zhulik Nov 21, 2015
0332f79
Readme updated
zhulik Nov 21, 2015
6539399
Test refactored
zhulik Nov 21, 2015
f8a3ac1
Small tests fix
zhulik Nov 21, 2015
6873dde
Bot getFileDirectUrl method added
zhulik Nov 21, 2015
399d665
Typo fix
zhulik Nov 21, 2015
af029c3
Bot IsMessageToMe method
zhulik Nov 21, 2015
6da34a6
Message IsCommand method added
zhulik Nov 21, 2015
2a5cf86
Updates channel removed from BotAPI
zhulik Nov 21, 2015
5859ba3
Small updates. Readme updated
zhulik Nov 21, 2015
d638757
go fmt
zhulik Nov 21, 2015
4037dbe
Lint issues fixed
zhulik Nov 21, 2015
667b68e
Package path changed before merge
zhulik Nov 21, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea/
coverage.out
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
language: go

go:
- 1.4
- tip
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Golang bindings for the Telegram Bot API

[![GoDoc](https://godoc.org/github.com/Syfaro/telegram-bot-api?status.svg)](http://godoc.org/github.com/Syfaro/telegram-bot-api)
[![Travis](https://travis-ci.org/Syfaro/telegram-bot-api.svg)](https://travis-ci.org/Syfaro/telegram-bot-api)

All methods have been added, and all features should be available.
If you want a feature that hasn't been added yet or something is broken, open an issue and I'll see what I can do.
Expand Down Expand Up @@ -34,18 +35,15 @@ func main() {
u := tgbotapi.NewUpdate(0)
u.Timeout = 60

err = bot.UpdatesChan(u)
if err != nil {
log.Panic(err)
}
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)
msg.ReplyToMessageID = update.Message.MessageID

bot.SendMessage(msg)
bot.Send(msg)
}
}
```
Expand Down Expand Up @@ -76,15 +74,15 @@ 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)
}
}
```

If you need, you may generate a self signed certficate, as this requires HTTPS / TLS. The above example tells Telegram that this is your certificate and that it should be trusted, even though it is not properly signed.

openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 3560 -subj -nodes
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 3560 -subj "//O=Org\CN=Test" -nodes