From 8455164a698bf0e305643c9afecc2cfb1f76640b Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Tue, 5 Oct 2021 16:46:04 +0200 Subject: [PATCH] Simplify command_bot example --- crates/matrix-sdk/examples/command_bot.rs | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/crates/matrix-sdk/examples/command_bot.rs b/crates/matrix-sdk/examples/command_bot.rs index 6e894cd41..51fdb1f94 100644 --- a/crates/matrix-sdk/examples/command_bot.rs +++ b/crates/matrix-sdk/examples/command_bot.rs @@ -12,18 +12,9 @@ use url::Url; async fn on_room_message(event: SyncMessageEvent, room: Room) { if let Room::Joined(room) = room { - let msg_body = if let SyncMessageEvent { - content: - MessageEventContent { - msgtype: MessageType::Text(TextMessageEventContent { body: msg_body, .. }), - .. - }, - .. - } = event - { - msg_body - } else { - return; + let msg_body = match event.content.msgtype { + MessageType::Text(TextMessageEventContent { body, .. }) => body, + _ => return, }; if msg_body.contains("!party") {