Commit Graph

56 Commits

Author SHA1 Message Date
Ian Byrd
ef59af6db7
Introducing Sendable interface (see #93.)
This commit refactors lots of duplicated code from bot.go, so
instead of having N redundant SendX methods, now it's the
responsibility of all Sendable objects to implement Send(..)
instead. Impl in types_send.go, 150 LOC only!
2017-11-17 08:20:36 +02:00
Ian Byrd
127bf18d79
Optimizes SendOptions / ReplyMarkup. 2017-11-17 04:51:03 +02:00
Ian Byrd
d8b3194888 Message: optionals are now stored by-pointer, saving 67.4% of mem.
This is a breaking change! Reducing memory usage from 1544 bytes
down to 504 bytes on 64-bit system. Considering Message is the
most used Telebot type, it's a pretty big deal.

Also, now we finally can test optional fields against nil!
2017-08-25 16:27:58 +03:00
Ian Byrd
4857ac8b9d
Whoops, fixing the merged code according to new API. 2017-08-19 19:19:57 +03:00
Ian Byrd
8128e90034
Merging #79 into 'v2'.
This commit breaks telebot API by introducing message edits and
changing return values for existing Send* methods.
2017-08-19 19:10:02 +03:00
Ian Byrd
b19ffa1b45
Experimental handlers API added. 2017-08-15 18:00:22 +03:00
Ian Byrd
a1a2c92dad
This commit refactors error handling throughout the library.
Bot.Errors channel has been introduced. It can be used to
debug Telebot. It also fixes sendFile() which used to upload
with its own custom http.Client instead of http.DefaultClient.
2017-08-15 16:44:01 +03:00
Ian Byrd
95901bcfc3
Minor time conversion change within private API. 2017-08-15 15:09:04 +03:00
Ian Byrd
14151d8a26 Revert "Bots now support custom HTTP clients (*http.Client)."
This reverts commit c8e1ac037f.
2017-08-11 05:29:55 +03:00
Ian Byrd
c8e1ac037f
Bots now support custom HTTP clients (*http.Client). 2017-08-03 02:14:18 +03:00
Vlad Lukyanov
d2067e919f changed InlineKeyboardMarkup to SendOptions where it needed 2017-05-10 12:08:11 +05:00
Vlad Lukyanov
15a4d8f413 Add meaasge edit feature
This commit may break some bots because changes in return of SendMessage
and SendPhoto functions
2017-01-12 05:48:11 +05:00
Ian Byrd
6360f1f7d9
Refactoring, poor BC, closes #44 and probably resolves #41.
- EntityType and ChatType enums introduced.
- Documentation fixes, struct refactoring.
- Poor BC, poor BC...
2016-11-10 22:04:50 +02:00
Ian Byrd
d8b2ca1983
Fixes lots of complete bollocks that got into the codebase.
- Malformed JSON field tags, OMG fixed
- Making linters happy
- Foursquare_id -> FoursquareID, fuck BC
2016-11-10 21:34:02 +02:00
Ian Byrd
fedfe0d5f9 Switching to int64 update queries, resolves #16 hopefully. 2016-11-10 01:34:57 +02:00
Ian Byrd
e0d2195801
Partial refactoring of internals.
- GetChat and LeaveChat handle error descriptions
- Documentation fix for Result type
- Wrapping structs for IQRs go inside marshal funcs.
2016-11-10 01:28:00 +02:00
ahmdrz
622415d138 LeaveChat boolean result removed 2016-10-15 10:52:58 +03:30
aiden
e5cf14aeea Method name and structs specified. 2016-10-14 18:31:45 +03:30
aiden
5d1a071046 Some changes for godoc 2016-10-10 00:12:07 +03:30
aiden
2558381794 GetUserProfilePhotos added 2016-10-09 23:59:03 +03:30
aiden
fc4d712ce0 getChatMember added 2016-10-09 23:46:33 +03:30
aiden
229001da4a getChatMemberCount added 2016-10-09 23:41:23 +03:30
aiden
d18a89193d getChatAdministrators added 2016-10-09 23:39:07 +03:30
aiden
936198888e getChat method added 2016-10-09 23:30:04 +03:30
aiden
08ec8d756a leaveChat method added 2016-10-09 23:27:08 +03:30
Illarionov Oleg
ce7114afe6 GetFile and GetFileDirectURL method to fetch url of file received from user (#63)
Bot.GetFile and Bot.GetFileDirectURL methods introduced.

* correct comment

* improve docs
2016-09-27 15:04:13 +03:00
Sebastian Schepens
587ba1a4dc
add AnswerCallbackQuery 2016-07-25 19:09:18 -03:00
Vlad Lukyanov
977e1d90f3 gofmt 2016-07-04 19:48:20 +05:00
Vlad Lukyanov
6e08411d89 fix. rewrite url.params to map 2016-07-04 19:45:08 +05:00
Vlad Lukyanov
4b79f3ff1b merge with upstream 2016-07-04 15:56:53 +05:00
Nick Groenen
46992b037b Improve support for inline queries
These changes make it possible to set custom options when responding to
inline queries, as described on
https://core.telegram.org/bots/api#answerinlinequery.

It also includes all the (non-cached) inline result types as described
at https://core.telegram.org/bots/api#inlinequeryresult.

Some remarks:
* The internals of sendCommand have changed. It now expects a
  JSON-serializable object. Instead of doing GET requests with
  URL-encoded query parameters it now POSTS JSON directly.
* Because of the above, sendFile() has changed as well. It now expects a
* `map[string]string` which it will internally convert to URL encoded
  form values.
* Respond has been deprecated in favor of the new AnswerInlineQuery
  function. It is only kept for backward compatibility.
* A dependency on https://github.com/mitchellh/hashstructure has been
  introduced in order to generate automatic IDs for inline results.
2016-06-26 16:33:16 +02:00
Vlad Lukyanov
0a92c6c68b Added Venue message support by calling SendVenue(recipient Recipient, venue *Venue, options *SendOptions) 2016-05-24 09:43:16 +05:00
Steven Berlanga
72e84f5ab5 Adding support for inline keyboard buttons 2016-04-29 18:20:50 -04:00
Ian Byrd
061a651188
This commit adds an inline mode implementation and resolves #28.
Only article results supported so far.
2016-01-22 13:38:45 +02:00
Ronmi Ren
143777fbe0 Channel support and change chat_id size
* Chage signature of "Destination()", because we need send username in "chat_id" when
  sending message to channel.
* By telegram API document, chat id is "not exceeding 1e13 by absolute value" which
  needs int64 to store it.
2015-12-24 16:51:42 +08:00
Ilya Kowalewski
651cd22f62 Tiny code changes 2015-11-16 12:22:37 +02:00
Ilya Kowalewski
72ce8fae88 Fixing #21 issue, introducing Recipient interface 2015-10-17 01:36:07 +03:00
Ilya Kowalewski
6e16b55de1 Getting rid of excessive error types, switching to fmt.Errorf 2015-10-15 18:17:09 +03:00
Ilya Kowalewski
0192b0946f go fmt 2015-08-05 20:53:20 +03:00
Ronmi Ren
77314762f1 This commit ensures we will not receive same message multiple times when
in bad network-speed environment. And message will be put to channel in
same order we receive from API call.

 * Bot.Listen(): Use only 1 goroutine. Do really long polling, not
   repeatly do short polling.
 * API.go: getUpdates(): as doing long polling, channel is not required.
2015-08-04 09:14:16 +08:00
Luke Plaster
79c044e8ec Easy older go compat
`go range` without loop values is new to 1.4. some of us are stuck with older go (wheezy backport is 1.3.3)
merge if you wish - this was a quick one
2015-07-24 17:12:37 +02:00
Ilya Kowalewski
40c91ee0b4 Added some API and tests 2015-07-06 20:12:08 +03:00
Ilya Kowalewski
eaf9b17a54 Achieving final satisfaction with golint 2015-07-06 19:27:57 +03:00
Ilya Kowalewski
8dab2461ef Chat actions implemented 2015-07-06 19:15:59 +03:00
Ilya Kowalewski
5da873e39b Fix for even more lint warnings 2015-07-06 16:53:59 +03:00
Ilya Kowalewski
fb0e91451e Significant API change, send options added 2015-07-06 16:46:51 +03:00
Ilya Kowalewski
e041242bb2 Fixed a bunch of lint issues 2015-07-03 21:58:29 +03:00
Ilya Kowalewski
104a45344a Sending docs, stickers, videos and locations 2015-07-03 19:25:04 +03:00
Ilya Kowalewski
51d01479b6 Sending audio 2015-07-03 15:27:18 +03:00
Ilya Kowalewski
6a4863ece8 Sending photos, API improvements 2015-07-02 21:39:39 +03:00