Commit graph

68 commits

Author SHA1 Message Date
Waffle
120ed97e8c TBA 5.3: Update methods 2021-07-04 16:06:06 +03:00
Waffle
421cf42835 Use url::Url for urls, use chrono::DateTime<Utc> for dates 2021-07-03 23:35:13 +03:00
Waffle
39c497ca1e Update methods to TBA 5.2 2021-05-04 16:47:16 +03:00
Waffle
aef88f97c3 Update to tba API version 5.1 2021-03-15 23:50:02 +03:00
Waffle
fa5ab5aa7c Update methods to tba 5.0 2021-03-14 22:55:25 +03:00
Temirkhan Myrzamadi
f87b4e51e6
Merge branch 'master' into fault_tolerant_get_updates 2021-03-06 12:11:38 +03:00
Waffle
7600a88312 Fix SetWebhook
Make `GetUpdates::allowed_updates` optional
2021-03-06 00:48:06 +03:00
Waffle
7e43c4d321 Add GetUpdatesFaultTolerant 2021-02-27 01:07:57 +03:00
Waffle
7025de58f5 Fix typos in payloads
- `get_updates`: `offset` `i64` -> `i32`
- `send_location`: make `live_period` optional
2021-02-22 11:30:13 +03:00
Waffle
dcdba78285 Fix send_contact singnature
- `phone_number: f64` -> `phone_number: String`
- `first_name: f64` -> `first_name: String`
2021-02-22 08:47:50 +03:00
Waffle
5b328105fa Sticker related fixes
- Rename `sticker_type.rs` => `input_sticker.rs` (after the contained type)
- Make `create_new_sticker_set` multipart
- Replace CreateNewStickerSet::{png,tgs}_sticker with `<_>::sticker`
- Fix GetStickerSet return type
- Revert some previous InputSticker changes: make the variants tuple structsm
  remove constructors
2021-01-26 13:43:21 +03:00
Waffle
55c02e3311 Use edition-2018 style modules
Use `module_name.rs` instead of `module_name/mod.rs`.

Pros:
- It's easier to find the module file (especially for modules with lots of
  submodules like `types`)
- Module file name is not 'magical'
2021-01-23 15:56:22 +03:00
Temirkhan Myrzamadi
8e011b7e60
Merge pull request #41 from teloxide/improve_docs
Improve docs
2021-01-21 18:52:16 +06:00
Waffle
84df33dbef improve docs 2021-01-15 22:06:23 +03:00
Waffle
49c3afbc39 fixup send_emoji method 2021-01-08 00:44:19 +03:00
Waffle
71d90002ce update dependencies 2021-01-07 15:58:51 +03:00
Waffle
6004d9189c fmt 2020-12-30 17:06:52 +03:00
Waffle Lapkin
114d1c3efb
Update src/bot/mod.rs
Co-authored-by: Temirkhan Myrzamadi <hirrolot@gmail.com>
2020-12-30 17:03:29 +03:00
Waffle
50d3d67f93 fmt 2020-12-28 19:06:46 +03:00
Waffle
f4e3aa13eb Add Bot::{set_,}api_url methods
The methods allow to set and get the Telegram bot API url.
2020-12-28 18:45:45 +03:00
Waffle
7cc79eda63 Fix API typos
- Make `caption` args optional
- Add missing game methods
2020-12-28 14:57:37 +03:00
Waffle
445c42b585 Refactor file downloading
- Make `net` module public
- Move `Bot::download_file{,_stream}` methods to a new `Download` trait
  - Add `download_forward` macro to forward `Download` impls (priv)
  - Impl `Download` for all bot adaptors & the `Bot` itself
- Change return type of `download_file_stream` — return `Stream<Result<Bytes>>``,
  instead of `Future<Result<Stream<Result<Bytes>>>>``
- Add `api_url` param to standalone versions of `download_file{,_stream}`
- Make `net::{TELEGRAM_API_URL, download_file{,_stream}}` pub
- Small documentation changes
2020-12-12 15:52:47 +03:00
Waffle
3491a668b2 Fix doc links... 2020-12-06 16:34:44 +03:00
Waffle
1882ff0bc4 Fix doc test 2020-12-06 16:31:30 +03:00
Waffle
84ac0212e8 Remove legacy code 2020-12-06 16:31:28 +03:00
Waffle
eb45ac7d88 Fix doc links 2020-11-27 01:39:35 +03:00
Waffle
45cf62ce8e Refactor Bot for a bit
- Move default parse mode to an adaptor
- Remove bot builder (it's not usefull anymore, since parse_mode is moved away)
    - Undeprecate bot constructors
2020-11-27 01:21:50 +03:00
Waffle
7c9c871b83 Remove empty generics lists, wheres and ', ' after self 2020-11-24 20:30:45 +03:00
Waffle
d7d8bc6246 Add all tba methods to Requester trait 2020-11-24 19:32:29 +03:00
Waffle
05582de2fd Add fixme to #[allow] attr in api_url 2020-11-17 22:43:34 +03:00
Waffle
17b44db578 Add ApiUrl
Add `ApiUrl` and also use `Url` instead of `&str` for urls to clean code
2020-11-17 22:38:30 +03:00
Waffle
fa0e86c547 Add internal ability to change API url
Recently, telegram has published [Telegram Bot API Server] - HTTP API <->
MTPROTO proxy which is used internally by telegram. Now it's possible to run
the server locally.

However currently it's not possible to use teloxide with such local server,
because API url is hardcoded into teloxide.

This commit makes _internall_ changes to allow setting the API url. It doesn't
yet allow to set the url from user code (i.e.: no changes in public API), in my
opinion such additions are blocked on some bot refactorings.

`Bot::api_url` is made `Option<Arc<str>>` to minimize costs in case of 'default
url' (probably the most common case).

Progress of this issue is tracked in https://github.com/teloxide/teloxide/issues/317

[Telegram Bot API Server]: https://github.com/tdlib/telegram-bot-api
2020-11-16 14:14:00 +03:00
Waffle
a213459cc3 fmt 2020-11-05 03:22:23 +03:00
Waffle
9d887e51bb Rename StickerType
- Rename `StickerType` => `InputSticker`
- Rename `{CreateNewStickerSet,AddStickerToSet}::sticker_type}` => `sticker`

This just makes more sense.
2020-11-04 16:00:40 +03:00
Waffle
9bf8c02c9d doc & feature fixes
- Remove `unstable-stream` feature
- Doc fixes
2020-10-21 05:17:35 +03:00
Waffle
e79f83d4a1 Move bot adaptors to own module and place then under features
This commit moves `bot::{auto_send,cache_me,limits}` modules to
`adaptors::{auto_send,cache_me,throttle}.

ALso it adds 4 crate features:
- `throttle`
- `cache_me`
- `auto_send`
- `full` (enables all features, except `nightly`)
2020-10-21 05:14:48 +03:00
Waffle
e54f45ceab Make the trait bounds in Request{,er} stricter 2020-10-20 12:17:07 +03:00
Waffle
8e44a0bcfc fmt: i can't see the difference 2020-10-03 03:39:50 +03:00
Waffle
2d7e40a473 [throttle] fix doc test 2020-10-03 03:30:34 +03:00
Waffle
e757999135 [throttle] git rebase, fmt and clippy things 2020-10-02 21:22:19 +03:00
Waffle
0aecda6348 [throttle] stop worker when channel is closed 2020-10-02 20:53:00 +03:00
Waffle
d43f2514d3 [throttle] use channel close to send unlock "messages"
Also use `with_capacity` for queue
2020-10-02 20:53:00 +03:00
Waffle
380e189ec7 [throttle] comment and doc improvements 2020-10-02 20:53:00 +03:00
Waffle
6f03ca0954 [throttle] hash ChatId::ChannelUsername to prevent expensive string cloning & make send{,_ref} enums private
The future has come!
2020-10-02 20:53:00 +03:00
Waffle
7fdf9cd9a6 [throttle] implement send_ref 2020-10-02 20:53:00 +03:00
Waffle
247868a815 [throttle] explicit queue-closed error handling & comments 2020-10-02 20:53:00 +03:00
Waffle
23ef060d08 [throttle] temporary resolve spawn_blocking fixme 2020-10-02 20:53:00 +03:00
Waffle
b38e35b630 [throttle] format, docs, modfix and small additions 2020-10-02 20:52:56 +03:00
Waffle
6714a9c503 [throttle] clear hchats_s instead of creating&dropping every iteration 2020-10-02 20:50:30 +03:00
Waffle
5f5e42054d [throttle] queue optimizations#1 2020-10-02 20:50:30 +03:00