Servers: Create and delete invites. Create and fetch servers.

This commit is contained in:
Paul
2021-06-05 22:41:47 +01:00
parent 681b2b8ab6
commit f9fbe54b17
16 changed files with 281 additions and 57 deletions

View File

@@ -186,6 +186,27 @@ impl Channel {
with: "channel",
})?;
// Remove from server object.
if let Channel::TextChannel { server, .. } = &self {
get_collection("servers")
.update_one(
doc !{
"_id": server
},
doc! {
"$pull": {
"channels": id
}
},
None,
)
.await
.map_err(|_| Error::DatabaseError {
operation: "update_one",
with: "servers",
})?;
}
ClientboundNotification::ChannelDelete { id: id.to_string() }.publish(id.to_string());
if let Channel::Group { icon, .. } = self {