Permissions: Add EmbedLinks / UploadFiles to channels

Web Push: Send events if mentioned
This commit is contained in:
Paul
2021-06-25 13:33:05 +01:00
parent b45ea266d8
commit 35b0c69cdb
3 changed files with 30 additions and 8 deletions

View File

@@ -59,7 +59,7 @@ impl Content {
None,
None
)
.publish(&target)
.publish(&target, false)
.await
}
}
@@ -109,7 +109,7 @@ impl Message {
}
}
pub async fn publish(self, channel: &Channel) -> Result<()> {
pub async fn publish(self, channel: &Channel, process_embeds: bool) -> Result<()> {
get_collection("messages")
.insert_one(to_bson(&self).unwrap().as_document().unwrap().clone(), None)
.await
@@ -230,8 +230,11 @@ impl Message {
});
}
self.process_embed();
if process_embeds {
self.process_embed();
}
let mentions = self.mentions.clone();
let enc = serde_json::to_string(&self).unwrap();
ClientboundNotification::Message(self).publish(channel.id().to_string());
@@ -250,6 +253,11 @@ impl Message {
}
}
}
Channel::TextChannel { .. } => {
if let Some(mut mentions) = mentions {
target_ids.append(&mut mentions);
}
}
_ => {}
}