mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 22:46:39 +01:00
Merge branch 'rework-dispatching' of https://github.com/teloxide/teloxide into rework-dispatching
This commit is contained in:
commit
44471d3090
3 changed files with 6 additions and 6 deletions
|
@ -35,7 +35,7 @@ pub enum MessageKind {
|
|||
Common {
|
||||
/// Sender, empty for messages sent to channels.
|
||||
#[serde(flatten)]
|
||||
from: Sender,
|
||||
from: Option<Sender>,
|
||||
|
||||
#[serde(flatten)]
|
||||
forward_kind: ForwardKind,
|
||||
|
@ -352,7 +352,7 @@ mod getters {
|
|||
/// NOTE: this is getter for both `from` and `author_signature`
|
||||
pub fn from(&self) -> Option<&Sender> {
|
||||
match &self.kind {
|
||||
Common { from, .. } => Some(from),
|
||||
Common { from, .. } => from.as_ref(),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -116,14 +116,14 @@ mod tests {
|
|||
photo: None,
|
||||
},
|
||||
kind: MessageKind::Common {
|
||||
from: Sender::User(User {
|
||||
from: Some(Sender::User(User {
|
||||
id: 0,
|
||||
is_bot: false,
|
||||
first_name: "".to_string(),
|
||||
last_name: None,
|
||||
username: None,
|
||||
language_code: None,
|
||||
}),
|
||||
})),
|
||||
forward_kind: ForwardKind::Origin {
|
||||
reply_to_message: None,
|
||||
},
|
||||
|
|
|
@ -158,14 +158,14 @@ mod test {
|
|||
photo: None,
|
||||
},
|
||||
kind: MessageKind::Common {
|
||||
from: Sender::User(User {
|
||||
from: Some(Sender::User(User {
|
||||
id: 218_485_655,
|
||||
is_bot: false,
|
||||
first_name: String::from("Waffle"),
|
||||
last_name: None,
|
||||
username: Some(String::from("WaffleLapkin")),
|
||||
language_code: Some(LanguageCode::EN),
|
||||
}),
|
||||
})),
|
||||
forward_kind: ForwardKind::Origin {
|
||||
reply_to_message: None,
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue