only send a subsect of the webhook in a message
This commit is contained in:
@@ -441,7 +441,7 @@ impl Channel {
|
||||
masquerade: data.masquerade,
|
||||
interactions: data.interactions.unwrap_or_default(),
|
||||
author: author_id,
|
||||
webhook,
|
||||
webhook: webhook.map(|w| w.into_message_webhook()),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
use crate::{
|
||||
events::client::EventV1,
|
||||
models::{
|
||||
webhook::{Webhook, PartialWebhook, FieldsWebhook}
|
||||
webhook::{Webhook, PartialWebhook, FieldsWebhook},
|
||||
message::MessageWebhook
|
||||
},
|
||||
Database, Result
|
||||
};
|
||||
@@ -56,9 +57,17 @@ impl Webhook {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn remove(&mut self, field: &FieldsWebhook) {
|
||||
pub fn remove(&mut self, field: &FieldsWebhook) {
|
||||
match field {
|
||||
FieldsWebhook::Avatar => self.avatar = None
|
||||
}
|
||||
}
|
||||
|
||||
pub fn into_message_webhook(self) -> MessageWebhook {
|
||||
MessageWebhook {
|
||||
id: self.id,
|
||||
name: self.name,
|
||||
avatar: self.avatar.map(|f| f.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user