Run Matrix commands in a task
This commit is contained in:
parent
04cd440c50
commit
771057925d
@ -97,7 +97,7 @@ async fn room_message_handler(
|
||||
.contains(&event.sender.to_string())
|
||||
&& text_content.body.starts_with(&state.display_name)
|
||||
{
|
||||
let bot_state = &state.bot_state;
|
||||
let bot_state = state.bot_state.clone();
|
||||
let client = bot_state.client.lock().unwrap().to_owned();
|
||||
let mut client = match client {
|
||||
Some(client) => client,
|
||||
@ -114,7 +114,7 @@ async fn room_message_handler(
|
||||
return;
|
||||
}
|
||||
};
|
||||
let command = &text_content
|
||||
let command = text_content
|
||||
.body
|
||||
.trim_start_matches(&state.display_name)
|
||||
.trim_start_matches(":")
|
||||
@ -128,6 +128,7 @@ async fn room_message_handler(
|
||||
command
|
||||
),
|
||||
);
|
||||
tokio::task::spawn(async move {
|
||||
log_error(
|
||||
room.send(
|
||||
RoomMessageEventContent::text_plain(
|
||||
@ -143,6 +144,7 @@ async fn room_message_handler(
|
||||
)
|
||||
.await,
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user