Commit Graph

258 Commits

Author SHA1 Message Date
Orivej Desh
f95090faf1 bot: expose ProcessUpdate and add Synchronous handlers mode
Bot.ProcessUpdate in synchronous mode can be used as an AWS Lambda function.
2020-04-28 15:35:44 +00:00
Demian
c14c51a668 bot: fix long poller stopping logic 2020-04-26 21:29:25 +03:00
Demian
5c1986f5b5 telebot: a lot of refactor and clean-ups 2020-04-26 18:19:49 +03:00
Demian
e786ae7401 bot: implement stopPoll method 2020-04-26 17:05:21 +03:00
Rocky Badland
b15f9a45d2 bot: fix misspell in deleteChatPhoto 2020-04-26 16:03:06 +03:00
Demian
32532699c5 bot: implement bot commands methods 2020-04-26 15:55:04 +03:00
Demian
f3f71c27e0 bot: implement setChatPermissions method 2020-04-26 14:47:08 +03:00
dande
9268c6dff7 dice: added constants 2020-04-25 15:59:53 +03:00
dande
3915e8596b dice: fixed dice handling 2020-04-25 15:31:16 +03:00
Demian
299838450e tests: implement b.EditReplyMarkup() function test 2020-04-23 21:56:27 +03:00
Demian
4e2f28c4f3 bot: implement editMessageLiveLocation, update some documentation 2020-04-16 18:56:47 +03:00
Demian
1654a203ea bot: check recipient for nil to avoid panics 2020-04-16 17:57:16 +03:00
Demian
784432503e tests: implement b.Send() function test 2020-04-16 17:52:15 +03:00
unknown
51a26d93ce Refactor incomingUpdate function 2020-04-06 22:27:58 +03:00
unknown
e5789a08bb Refactor unexported code 2020-04-06 16:04:25 +03:00
unknown
4cab32f46e Fire OnPinned for channel post (closes #244) 2020-04-06 14:22:01 +03:00
unknown
fcff7569ac Implement bot Handle and Start functions tests 2020-04-06 12:57:18 +03:00
unknown
32de86819c Update Handle documentation 2020-04-06 11:40:31 +03:00
unknown
ce43c6a8a2 Refactor code, fix code style issues 2020-04-05 20:23:51 +03:00
Nikita Bikmaev
66e7021870 Move a code to sendable.go and update the README.md 2020-03-31 00:04:16 +03:00
Nikita Bikmaev
4b74a0ebcc Fix documentation 2020-03-30 19:37:41 +03:00
Nikita Bikmaev
69f0836940 Implement sendPoll method 2020-03-30 19:21:06 +03:00
Ian Patrick Badtrousers
3458aeb2e7 Revert "MarkdownV2 as default, use MarkdownLegacy for old-fashioned MD."
This reverts commit 12299becfa.
2020-03-29 14:59:27 +02:00
Ian Patrick Badtrousers
12299becfa MarkdownV2 as default, use MarkdownLegacy for old-fashioned MD. 2020-03-29 01:49:17 +01:00
Mikhail Borovikov
9852df39ae Add support parse_mode for albums photo 2020-03-01 03:12:13 +03:00
Tobias Tangemann
b6c3367fed Fix OnMigration handler haven from=0 (#245)
Fixes tucnak/telebot/issues#187
2020-01-20 19:55:35 +03:00
Viktor Oreshkin
baa616bc00 EditMedia: Fix possible thumb attach name conflict 2019-12-26 02:47:05 +03:00
Viktor Oreshkin
ddbfc934ff rename FileJson to FileJSON to make linter happy 2019-12-26 02:42:52 +03:00
Viktor Oreshkin
f4d7467b6e Rewrite IfElseChain to switch 2019-12-26 02:42:20 +03:00
Viktor Oreshkin
24589f3665 remove unused function (*Bot).handleCommand 2019-12-26 02:20:59 +03:00
Viktor Oreshkin
a67e593e35 GetFile: use b.client, check status code 2019-12-26 02:17:34 +03:00
Viktor Oreshkin
6cf54c1557 Improve some loops (use copy, style fix) 2019-12-26 02:04:23 +03:00
Viktor Oreshkin
a770d6d951 Fix typos and misspells 2019-12-26 01:55:51 +03:00
Viktor Oreshkin
10b553411d Add options to EditCaption (incl ParseMode) (#230) 2019-12-26 01:44:01 +03:00
demiangetman
a855bcb241 Fix possible EditMedia sendOpts nil dereference 2019-12-26 01:40:46 +03:00
demiangetman
921282a488 Add ParseMode option support to EditMedia 2019-12-26 01:40:46 +03:00
Viktor Oreshkin
ca2149b44f Handle audio thumbnail in EditMedia 2019-12-26 01:21:11 +03:00
demiangetman
53bfa49b78 Fill callback inline message on update 2019-12-08 11:57:09 +03:00
demiangetman
97589a3d9e Add options to EditCaption 2019-11-03 16:17:46 +03:00
demiangetman
366e68b072 Implement EditReplyMarkup 2019-09-30 18:24:59 +03:00
Arseny Mitin
83aacd12ee refactor: avoid using fmt.Sprintf for performance 2019-09-17 10:05:21 +03:00
evgendn
240965f18d Add stickers methods 2019-07-29 23:04:52 +05:00
Ian Byrd
9b714b274c reducing excessive deffered calls 2019-03-29 16:25:48 +02:00
Ian Byrd
42933c1912 small fixes, go.{mod,sum} 2019-03-29 16:25:48 +02:00
Ian Byrd
85ee746b3c
Merge pull request #194 from 23rd/patch-1-edit-media
Added support for editMessageMedia.
2019-03-26 15:22:23 +02:00
robatioor
5601dd0354 add method GetFile and refactor code 2019-03-03 08:44:14 +03:30
23rd
c7451550a3 Added support for editMessageMedia.
- Fixes #184.
2019-02-20 09:11:32 +03:00
Ian Byrd
7eeea8f32a
Payment API minimal implementation. 2019-01-28 02:42:41 +02:00
Anton Kucherov
538b671e6a fix #173 add custom Telegram api url 2018-12-13 01:45:03 +03:00
Ian Byrd
2adea7c8be
Merge pull request #163 from stek29/filereader
Add File creation from io.Reader (fix #137)
2018-10-11 14:50:05 +03:00
Viktor Oreshkin
ec2090d300 Dont panic in Bot.Send, just return error 2018-10-11 14:40:16 +03:00
Viktor Oreshkin
629fe58962 Add File creation from io.Reader (fix #137)
Refactor sendFiles to accept Files
2018-10-11 14:39:07 +03:00
Viktor Oreshkin
fd3c84fce1 Embed optional fields in SendAlbum 2018-09-15 15:15:08 +03:00
Ian Byrd
b59ea4aec3
Merge pull request #146 from aprosvetova/patch-1
fixed wrong method name
2018-07-19 02:27:49 +03:00
Ian Byrd
89d8b20796
Merge pull request #141 from igorcoding/patch-1
Fix incorrect parsing of ChannelPrivate chat
2018-07-11 11:37:41 +03:00
Ulrich Schreiner
97e78127ad
fix lint errors in current code 2018-06-30 22:34:04 +02:00
Anna Prosvetova
fc1a751391
fixed wrong method name 2018-06-29 20:29:20 +03:00
igorcoding
111bf7658b
Fix incorrect parse of channelprivate Chat type 2018-05-19 19:22:14 +03:00
Andrey Sevrikov
10a33dd585 Fix voice handlers not firing 2018-04-24 18:46:07 +03:00
sigurniv
78f08282d7 fixed indentation 2018-04-18 21:17:03 +03:00
sigurniv
5f938b2a7a add option to pass custom http.Client to tb.NewBot() in case of proxying and other needs 2018-04-18 16:42:18 +03:00
Giovanni Spera
5513a66463 Fixed could not send message to private channel 2017-12-30 13:08:44 +01:00
Ian Byrd
3f24832170 Fix for a silly typo. 2017-12-27 00:46:50 +02:00
Ian Byrd
bda24d8650 Possibly breaking some builds, but inline message IDs won't work
otherwise.
2017-12-27 00:39:15 +02:00
Ian Byrd
f704eefacf ChosenInlineResult. 2017-12-26 03:15:10 +02:00
Ian Byrd
426f436905
Fix for data-less inline buttons. 2017-12-11 00:32:08 +02:00
Ian Byrd
bdd5916b83
Callbacks fixed for both button types. 2017-12-10 20:51:43 +02:00
Martin Ottenwaelter
6adfa4be13 Fixes a nil pointer dereference by checking a nil value for the
OnAddedToGroup handler.
2017-12-08 12:09:32 +01:00
Ian Byrd
77d1ba9eb1 Inline mode fix. 2017-11-29 22:31:07 +02:00
Ian Byrd
4f400f035e
Raw() method introduced. KeyboardButton -> ReplyButton. 2017-11-29 00:15:50 +02:00
Ian Byrd
38298d3e9d
Reporter: protection from in-handler panics. 2017-11-27 17:58:41 +02:00
Ian Byrd
4cf58f4c5b
Automatic command payload handling. 2017-11-27 16:56:22 +02:00
Ian Byrd
5a73cee70a
Handle() now supports keyboard buttons as endpoints. 2017-11-27 16:19:42 +02:00
Ian Byrd
119a4e1698
Modified poller API, fixes #106. 2017-11-27 14:52:16 +02:00
Ian Byrd
3329d98249
Completing regular API now. 2017-11-26 11:15:11 +02:00
Ian Byrd
2a1158c03a Revert "Protecting callbacks with callback guards."
This reverts commit 6f068bdacb.
2017-11-26 09:57:58 +02:00
Ian Byrd
31f0da895e
Graceful shutdown with Stop(), resolves #99, #105 2017-11-26 05:40:49 +02:00
Ian Byrd
6f068bdacb
Protecting callbacks with callback guards. 2017-11-26 05:10:06 +02:00
Ian Byrd
eae6345b88
InlineButton became endpoint (callback handling.) 2017-11-26 04:33:28 +02:00
Ian Byrd
d6ef68605b
Complete list of endpoints is now supported (see const.) 2017-11-26 03:38:30 +02:00
Ian Byrd
af9f8f00da
Pin/Unpin methods added. 2017-11-26 02:44:32 +02:00
Ian Byrd
83eb527fe5
Albums added, this commit resolves #103. 2017-11-25 16:22:13 +02:00
Ian Byrd
33e1846abd
Download() introduced. 2017-11-24 17:58:40 +02:00
Ian Byrd
79dccd7227
Endpoints for media introduced, Message.From -> Message.Sender 2017-11-24 17:24:07 +02:00
Ian Byrd
612ab345bd Improved inline API. TODO proper result types. 2017-11-24 16:11:07 +02:00
Ian Byrd
9aad0c4faa
OnAddedToGroup introduced. 2017-11-23 04:13:15 +02:00
Ian Byrd
091bbc9a13 Administration tools, this resolves #43. 2017-11-21 17:29:44 +02:00
Ian Byrd
b4bec5b6f7
Command routing fix. 2017-11-21 14:40:49 +02:00
Ian Byrd
ddc9f75fb2
More documentation, little code changes. 2017-11-21 05:08:06 +02:00
Ian Byrd
52892914f3
Security measure: ignoring all messages starting with \a 2017-11-21 04:55:53 +02:00
Ian Byrd
337be69aa3
Routing system: final touches! 2017-11-21 04:22:45 +02:00
Ian Byrd
0cf9b9a101
Routing: Handle() and Endpoint introduced. 2017-11-21 03:50:44 +02:00
Ian Byrd
ba575e72e1
Start(), Update now supports edited messages / channel posts. 2017-11-21 02:00:58 +02:00
Ian Byrd
43be06e850
NewBot, Settings, Poller, LongPoller - new bot creation API. 2017-11-21 01:41:39 +02:00
Ian Byrd
0f1d521167
Cleanup, documentation, bikeshedding. 2017-11-19 17:21:25 +02:00
Ian Byrd
d5e4082eaf
New Edit() and EditCaption() methods are taking over.
IMO, we shouldn't be introducing distinct EditText/EditMarkup
methods because it just doesn't make sense, you can do both in
one and EditCaption is a pretty odd case so we live it be.
2017-11-19 03:44:31 +02:00
Ian Byrd
ff0015f004
Good news Edit() now works for all Editable text messages! 2017-11-18 20:47:04 +02:00
Ian Byrd
b6938a118c
Telebot now compiles! :-) 2017-11-18 16:44:57 +02:00
Ian Byrd
dbc2cd7f6d
Massive refactoring and file structure changes.
- Callback structs has been moved to callbacks.go
- User / Chat and its methods -> chat.go
- Concept of Editable and Message Signature introduced
- No more types.go, it's been refactored into media.go + friends
2017-11-18 15:06:20 +02:00
Ian Byrd
a8671a839d
More refactoring, API rethinking. 2017-11-18 12:19:58 +02:00
Ian Byrd
3cf300d59d
Documentation for latest changes. 2017-11-17 16:29:44 +02:00
Ian Byrd
6eec63ddbb
Delete() has been added. 2017-11-17 09:22:16 +02:00
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