matrix-sdk: Fix the wasm bot example.

master
Damir Jelić 2020-08-26 16:19:39 +02:00
parent a2f7297941
commit 977e29c3af
2 changed files with 9 additions and 9 deletions

View File

@ -2,7 +2,7 @@ use matrix_sdk::{
api::r0::sync::sync_events::Response as SyncResponse,
events::{
room::message::{MessageEventContent, TextMessageEventContent},
AnySyncMessageEvent, AnySyncRoomEvent, SyncMessageEvent,
AnyMessageEventContent, AnySyncMessageEvent, AnySyncRoomEvent, SyncMessageEvent,
},
identifiers::RoomId,
Client, ClientConfig, SyncSettings,
@ -32,15 +32,15 @@ impl WasmBot {
console::log_1(&format!("Received message event {:?}", &msg_body).into());
if msg_body.starts_with("!party") {
let content = MessageEventContent::Text(TextMessageEventContent::plain(
"🎉🎊🥳 let's PARTY with wasm!! 🥳🎊🎉".to_string(),
let content = AnyMessageEventContent::RoomMessage(MessageEventContent::Text(
TextMessageEventContent::plain("🎉🎊🥳 let's PARTY with wasm!! 🥳🎊🎉".to_string()),
));
self.0.room_send(&room_id, content, None).await.unwrap();
}
}
async fn on_sync_response(&self, response: SyncResponse) {
console::log_1(&format!("Synced").into());
console::log_1(&"Synced".to_string().into());
for (room_id, room) in response.rooms.join {
for event in room.timeline.events {

View File

@ -28,21 +28,21 @@ use matrix_sdk_common::{
api::r0 as api,
events::{
ignored_user_list::IgnoredUserListEvent, push_rules::PushRulesEvent,
room::member::MemberEventContent, AnyBasicEvent, AnyMessageEventContent,
AnyStrippedStateEvent, AnySyncEphemeralRoomEvent, AnySyncMessageEvent, AnySyncRoomEvent,
AnySyncStateEvent,
room::member::MemberEventContent, AnyBasicEvent, AnyStrippedStateEvent,
AnySyncEphemeralRoomEvent, AnySyncMessageEvent, AnySyncRoomEvent, AnySyncStateEvent,
},
identifiers::{RoomId, UserId},
locks::RwLock,
push::Ruleset,
uuid::Uuid,
Raw,
};
#[cfg(feature = "encryption")]
use matrix_sdk_common::{
api::r0::keys::claim_keys::Request as KeysClaimRequest,
api::r0::to_device::send_event_to_device::IncomingRequest as OwnedToDeviceRequest,
events::room::encrypted::EncryptedEventContent, identifiers::DeviceId,
events::{room::encrypted::EncryptedEventContent, AnyMessageEventContent},
identifiers::DeviceId,
uuid::Uuid,
};
#[cfg(feature = "encryption")]
use matrix_sdk_crypto::{