57 lines
1.5 KiB
Rust
57 lines
1.5 KiB
Rust
use chrono::DateTime;
|
|
use teloxide::types::{
|
|
Chat, ChatId, ChatKind, ChatPublic, MediaKind::Text, MediaText, Message, MessageCommon,
|
|
MessageId, MessageKind::Common, PublicChatKind::Group,
|
|
};
|
|
|
|
pub fn generate_msg_mock(text: &str) -> Message {
|
|
let chat_id = ChatId { 0: 0 };
|
|
let public_chat_kind = Group;
|
|
let chat_kind = ChatKind::Public(ChatPublic {
|
|
title: None,
|
|
kind: public_chat_kind,
|
|
});
|
|
|
|
let chat = Chat {
|
|
id: chat_id,
|
|
kind: chat_kind,
|
|
};
|
|
|
|
let media_kind = Text(MediaText {
|
|
text: text.to_string(),
|
|
entities: Vec::new(),
|
|
link_preview_options: None,
|
|
});
|
|
|
|
let message_kind = Common(MessageCommon {
|
|
author_signature: None,
|
|
reply_to_message: None,
|
|
edit_date: None,
|
|
media_kind,
|
|
reply_markup: None,
|
|
is_automatic_forward: false,
|
|
has_protected_content: false,
|
|
paid_star_count: None,
|
|
effect_id: None,
|
|
forward_origin: None,
|
|
external_reply: None,
|
|
quote: None,
|
|
reply_to_story: None,
|
|
sender_boost_count: None,
|
|
business_connection_id: None,
|
|
is_from_offline: false,
|
|
});
|
|
Message {
|
|
chat,
|
|
via_bot: None,
|
|
thread_id: None,
|
|
kind: message_kind,
|
|
date: DateTime::from_timestamp_nanos(0),
|
|
id: MessageId { 0: 0 },
|
|
from: None,
|
|
is_topic_message: false,
|
|
sender_business_bot: None,
|
|
sender_chat: None,
|
|
}
|
|
}
|