Maybe Waffle
705083c2d9
Add UserId::{url, is_anonymous, is_channel, is_telegram}
functions
2022-04-02 20:59:41 +04:00
Waffle Maybe
1746be2b7f
Merge pull request #194 from teloxide/chat_id_refactor
...
Chat and user id refactor
2022-04-02 19:11:42 +04:00
Waffle Maybe
c250a9b327
Merge pull request #193 from teloxide/telergam
...
Fix a typo in documentation
2022-04-02 18:40:06 +04:00
Maybe Waffle
c2d2a15ef1
Split derives because rustfmt hates me
2022-04-02 18:13:32 +04:00
Maybe Waffle
71dee3b563
Use Into<ChatId>
in methods
2022-04-02 18:10:47 +04:00
Maybe Waffle
4fbec56674
Impl From<UserId>
for ChatId
and Recipient
2022-04-02 18:10:47 +04:00
Maybe Waffle
036c46caaa
reformat code a bit
2022-04-02 18:10:46 +04:00
Maybe Waffle
f2378935b7
Make chat id typed (add ChatId
)
...
Note that this is different from the previous `ChatId` (that was renamed
to `Recipient`), since it can't hold @channelusername.
Reason: same as w/ `UserId`
2022-04-02 18:10:46 +04:00
Maybe Waffle
41e09159a6
Make user id typed (add UserId
)
...
Reason: when user id is just an integer, it's easy to accidentally
use a "random" integer instead of actual user id, typed APIs make code
less prone to some mistakes.
This commit also fixes an issue when a wrong integer type was used for
`user_id` in `Contact`.
Another option that this addition unlocks is adding methods/implementing
foreign trait for `UserId`.
2022-04-02 18:10:46 +04:00
Maybe Waffle
0a1d73c223
Rename ChatId
=> Recipient
...
Reason: it isn't _really_ a chat id, it can also be a channel username.
2022-04-02 18:10:46 +04:00
Maybe Waffle
22cfffc704
Fix some more typos
2022-03-24 21:32:01 +04:00
Waffle Maybe
ecf90c8c05
Fix a typo in documentation
2022-03-24 17:51:34 +04:00
Maybe Waffle
3d69d96182
Fix chat unmark
2022-03-22 22:08:47 +04:00
Maybe Waffle
923be2221d
Add NotFound
error
2022-03-21 19:10:12 +04:00
Hirrolot
2c0748f3ae
Merge branch 'master' into with_payload
2022-03-20 08:08:52 -07:00
Maybe Waffle
d8e3c6ce42
Add WrongFileIdOrUrl
and FailedToGetUrlContent
errors
2022-03-18 14:21:55 +04:00
Maybe Waffle
c7e32fa247
Add HasPayload::with_payload_mut
function
...
`HasPayload::with_payload_mut` allows to easily apply multiple changes
to the payload without calling `payload_mut()` multiple times and
creating temporary variable for the request. e.g.:
```rust
// without `with_payload_mut`
{
let mut req = bot.set_webhook(url.clone());
req.payload_mut().certificate = certificate.take();
req.payload_mut().drop_pending_updates = drop_pending_updates;
req.send().await?;
}
// with `with_payload_mut`
bot
.set_webhook(url.clone())
.with_payload_mut(|payload| {
payload.certificate = certificate.take();
payload.drop_pending_updates = drop_pending_updates;
})
.send()
.await?
```
2022-03-18 14:13:38 +04:00
Waffle Maybe
0c5f9678d8
Merge pull request #185 from teloxide/revert_better_timeouts
...
Revert "better timeouts"
2022-03-07 20:16:53 +04:00
Maybe Waffle
5fb0a4787f
fix typos
2022-03-03 02:23:46 +03:00
Maybe Waffle
fbbb5c842b
Add User::is_telegram
2022-03-03 02:23:40 +03:00
Maybe Waffle
9eb51ad34b
fix clippy
2022-03-03 02:21:52 +03:00
Maybe Waffle
d5ad882999
fix typos
2022-03-03 01:45:41 +03:00
Maybe Waffle
812f6ef45e
Revert buggy "better timeouts"
2022-03-03 01:43:25 +03:00
mikhailantoshkin
686ec23b76
Add missing enum variants to the chat fucntion
2022-02-20 22:56:29 +05:00
Maybe Waffle
1d7825c97a
Prepare 0.4.2
release
2022-02-17 15:03:41 +03:00
Maybe Waffle
6bf204221f
Deprecate Message::chat_id
2022-02-17 14:51:00 +03:00
Maybe Waffle
3477f7eded
Fix sending quiz polls
2022-02-17 14:10:39 +03:00
Maybe Waffle
fb7710b838
Make GetUpdates
expose its timeout
via Payload::timeout_hint
2022-02-14 19:53:19 +03:00
Maybe Waffle
2dc4a915ba
Add a way for long-running requests to increase network timeout
2022-02-14 19:52:43 +03:00
Maybe Waffle
8d89fdccbd
Fix Update
de/serialization tests
2022-02-13 20:58:33 +03:00
Maybe Waffle
c0795f0dc9
Add regression test for issue 523
2022-02-13 20:53:58 +03:00
Maybe Waffle
fb523f153e
Fix deserialization of UntilDate
2022-02-13 20:53:41 +03:00
Waffle Maybe
d83f7180c4
Merge pull request #175 from teloxide/tba_5.7
...
TBA 5.7
2022-02-03 17:39:16 +03:00
Waffle Maybe
1c2a38eeb6
Merge pull request #173 from teloxide/docs_examples_blah
...
Change process of building docs
2022-02-03 17:38:52 +03:00
Flattergaster
82eb96b405
Fix deserialization of ChatInviteLink::pending_join_request_count
2022-02-02 22:38:03 +03:00
Maybe Waffle
c34a1386df
Fix test
2022-02-01 21:14:09 +03:00
Maybe Waffle
044f33551e
TBA 5.7: Add Sticker{,Set}::is_video
2022-02-01 20:12:26 +03:00
Maybe Waffle
6384560195
TBA 5.7: Add InputSticker::Webm
2022-02-01 19:39:29 +03:00
Maybe Waffle
16630133db
Add regression test for WebhookInfo
with an empty url
2022-02-01 18:31:04 +03:00
Maybe Waffle
a36794c5d3
Make WebhookInfo::allowed_updates
typed
2022-02-01 18:30:40 +03:00
Maybe Waffle
dde40e613f
Change process of building docs
...
- introduce `docs` alias that does the right thing (tm)
- use `-Zrustdoc-scrape-examples`
2022-01-31 18:23:30 +03:00
Hirrolot
bd4218c238
Merge branch 'master' into input_file_refactor
2022-01-30 20:14:30 +06:00
Maybe Waffle
38f2a5fef2
Make WebhookInfo::ip_address
typed
2022-01-27 20:25:40 +03:00
Maybe Waffle
6598ed9f42
Remove redundant settings from default_reqwest_settings
2022-01-19 22:34:12 +03:00
Maybe Waffle
df88d83cfd
Fix documentation
2022-01-13 20:43:33 +03:00
Maybe Waffle
622b0d9232
Remove dbg!
...
:/
2022-01-13 17:14:55 +03:00
Maybe Waffle
bc440b9ea8
fix clippy
2022-01-13 17:14:24 +03:00
Maybe Waffle
ef33f9f66a
Add more tests for multipart request serialization
2022-01-13 17:14:24 +03:00
Maybe Waffle
5b4ed3faa9
Allow sending impl AsyncRead
...
This commit adds `InputFile::read` constructor that creates `InputFile`
from an `impl AsyncRead + Send + Unpin + 'static`.
Internally this requires quite a bit of work, since we need to support
cloning `InputFile`s but the `AsyncRead` trait only allows us reading it
once.
To support this, if `InputFile` detects that it's shared, it reads the
contents of the `AsyncRead` into a buffer and then shares the buffer
(or an error if it has occured).
2022-01-13 17:14:24 +03:00
Maybe Waffle
a84e897db9
Refactor multipart requests
...
This removes the logic in the multipart serializer that unserialized
`InputFile`s from serde. Now `InputFile`s are serialized either as
their value (for `FileId` and `Url`) or as an `attach://<id>` string
where `<id>` is replaced with some id unique for the file. The file data
itself is acquired through `MultipartPayload` trait.
Since the `<id>` must be the same while serializing the file with serde
and while acquiring data through `MultipartPayload` trait, `InputFile`
needs to store said id. As such, `InputFile` is now a structure with
private fields and it's structure can't be observed by users. The only
things that `InputFile` provides are
- Constructors (`url`, `file_id`, `file`, `memory`)
- File name setter
- `Clone` and `Debug` implementations
2022-01-13 17:14:13 +03:00