55 lines
1.5 KiB
Rust
55 lines
1.5 KiB
Rust
use chrono::DateTime;
|
|
use teloxide::types::{
|
|
Chat, ChatId, ChatKind, ChatPublic, MediaKind::Text, MediaText, Message, MessageCommon,
|
|
MessageId, MessageKind::Common, PublicChatGroup, PublicChatKind::Group,
|
|
};
|
|
|
|
pub fn generate_msg_mock(text: &str) -> Message {
|
|
let chat_id = ChatId { 0: 0 };
|
|
let public_chat_kind = Group(PublicChatGroup { permissions: None });
|
|
let chat_kind = ChatKind::Public(ChatPublic {
|
|
title: None,
|
|
kind: public_chat_kind,
|
|
description: None,
|
|
invite_link: None,
|
|
has_protected_content: None,
|
|
});
|
|
|
|
let chat = Chat {
|
|
has_aggressive_anti_spam_enabled: false,
|
|
has_hidden_members: false,
|
|
id: chat_id,
|
|
pinned_message: None,
|
|
photo: None,
|
|
message_auto_delete_time: None,
|
|
kind: chat_kind,
|
|
};
|
|
|
|
let media_kind = Text(MediaText {
|
|
text: text.to_string(),
|
|
entities: Vec::new(),
|
|
});
|
|
|
|
let message_kind = Common(MessageCommon {
|
|
from: None,
|
|
sender_chat: None,
|
|
author_signature: None,
|
|
forward: None,
|
|
reply_to_message: None,
|
|
edit_date: None,
|
|
media_kind,
|
|
reply_markup: None,
|
|
is_topic_message: false,
|
|
is_automatic_forward: false,
|
|
has_protected_content: false,
|
|
});
|
|
Message {
|
|
chat,
|
|
via_bot: None,
|
|
thread_id: None,
|
|
kind: message_kind,
|
|
date: DateTime::from_timestamp_nanos(0),
|
|
id: MessageId { 0: 0 },
|
|
}
|
|
}
|