events: Add markdown constructors to RoomMessageEventContent
This commit is contained in:
parent
b3af33f1fc
commit
8fcd58c8de
@ -58,6 +58,12 @@ impl RoomMessageEventContent {
|
|||||||
Self::new(MessageType::Text(TextMessageEventContent::html(body, html_body)))
|
Self::new(MessageType::Text(TextMessageEventContent::html(body, html_body)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A constructor to create a markdown message.
|
||||||
|
#[cfg(feature = "markdown")]
|
||||||
|
pub fn text_markdown(body: impl AsRef<str> + Into<String>) -> Self {
|
||||||
|
Self::new(MessageType::Text(TextMessageEventContent::markdown(body)))
|
||||||
|
}
|
||||||
|
|
||||||
/// A constructor to create a plain text notice.
|
/// A constructor to create a plain text notice.
|
||||||
pub fn notice_plain(body: impl Into<String>) -> Self {
|
pub fn notice_plain(body: impl Into<String>) -> Self {
|
||||||
Self::new(MessageType::Notice(NoticeMessageEventContent::plain(body)))
|
Self::new(MessageType::Notice(NoticeMessageEventContent::plain(body)))
|
||||||
@ -68,6 +74,12 @@ impl RoomMessageEventContent {
|
|||||||
Self::new(MessageType::Notice(NoticeMessageEventContent::html(body, html_body)))
|
Self::new(MessageType::Notice(NoticeMessageEventContent::html(body, html_body)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A constructor to create a markdown notice.
|
||||||
|
#[cfg(feature = "markdown")]
|
||||||
|
pub fn notice_markdown(body: impl AsRef<str> + Into<String>) -> Self {
|
||||||
|
Self::new(MessageType::Notice(NoticeMessageEventContent::markdown(body)))
|
||||||
|
}
|
||||||
|
|
||||||
/// Creates a plain text reply to a message.
|
/// Creates a plain text reply to a message.
|
||||||
pub fn text_reply_plain(reply: impl Into<String>, original_message: &RoomMessageEvent) -> Self {
|
pub fn text_reply_plain(reply: impl Into<String>, original_message: &RoomMessageEvent) -> Self {
|
||||||
let quoted = get_plain_quote_fallback(original_message);
|
let quoted = get_plain_quote_fallback(original_message);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user