feat: channel model implementation (#250)

Co-authored-by: ToastXC <100072983+toastxc@users.noreply.github.com>
This commit is contained in:
Paul Makles
2023-06-04 18:52:49 +01:00
committed by GitHub
parent 3c834d06d4
commit bf3e027067
27 changed files with 1391 additions and 99 deletions

View File

@@ -7,7 +7,7 @@ use schemars::{
JsonSchema,
};
use crate::{Bot, Database};
use crate::{Bot, Database, Webhook};
/// Reference to some object in the database
#[derive(Serialize, Deserialize)]
@@ -26,6 +26,11 @@ impl Reference {
pub async fn as_bot(&self, db: &Database) -> Result<Bot> {
db.fetch_bot(&self.id).await
}
/// Fetch webhook from Ref
pub async fn as_webhook(&self, db: &Database) -> Result<Webhook> {
db.fetch_webhook(&self.id).await
}
}
#[cfg(feature = "rocket-impl")]