forked from projectmoon/tenebrous-dicebot
Store room info when joining a room.
This commit is contained in:
parent
c8c38ac1d4
commit
118e4b00c7
|
@ -100,6 +100,16 @@ async fn record_room_information(
|
||||||
) -> Result<(), crate::db::errors::DataError> {
|
) -> Result<(), crate::db::errors::DataError> {
|
||||||
let room_id_str = room.room_id.as_str();
|
let room_id_str = room.room_id.as_str();
|
||||||
let usernames = matrix::get_users_in_room(&client, &room.room_id).await;
|
let usernames = matrix::get_users_in_room(&client, &room.room_id).await;
|
||||||
|
|
||||||
|
let info = crate::models::RoomInfo {
|
||||||
|
room_id: room_id_str.to_owned(),
|
||||||
|
room_name: room.display_name(),
|
||||||
|
};
|
||||||
|
|
||||||
|
// TODO this and the username adding should be one whole
|
||||||
|
// transaction in the db.
|
||||||
|
db.rooms.insert_room_info(&info)?;
|
||||||
|
|
||||||
usernames
|
usernames
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter(|username| username != our_username)
|
.filter(|username| username != our_username)
|
||||||
|
|
Loading…
Reference in New Issue