forked from jmug/stoatchat
refactor(core): remove quark references from webhook routes
This commit is contained in:
@@ -402,6 +402,17 @@ impl From<crate::Interactions> for Interactions {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Interactions> for crate::Interactions {
|
||||
fn from(value: Interactions) -> Self {
|
||||
crate::Interactions {
|
||||
reactions: value
|
||||
.reactions
|
||||
.map(|reactions| reactions.into_iter().collect()),
|
||||
restrict_reactions: value.restrict_reactions,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<crate::AppendMessage> for AppendMessage {
|
||||
fn from(value: crate::AppendMessage) -> Self {
|
||||
AppendMessage {
|
||||
@@ -420,6 +431,16 @@ impl From<crate::Masquerade> for Masquerade {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Masquerade> for crate::Masquerade {
|
||||
fn from(value: Masquerade) -> Self {
|
||||
crate::Masquerade {
|
||||
name: value.name,
|
||||
avatar: value.avatar,
|
||||
colour: value.colour,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<crate::ServerBan> for ServerBan {
|
||||
fn from(value: crate::ServerBan) -> Self {
|
||||
ServerBan {
|
||||
|
||||
@@ -7,7 +7,7 @@ use schemars::{
|
||||
JsonSchema,
|
||||
};
|
||||
|
||||
use crate::{Bot, Database, Webhook};
|
||||
use crate::{Bot, Channel, Database, Webhook};
|
||||
|
||||
/// Reference to some object in the database
|
||||
#[derive(Serialize, Deserialize)]
|
||||
@@ -27,6 +27,11 @@ impl Reference {
|
||||
db.fetch_bot(&self.id).await
|
||||
}
|
||||
|
||||
/// Fetch channel from Ref
|
||||
pub async fn as_channel(&self, db: &Database) -> Result<Channel> {
|
||||
db.fetch_channel(&self.id).await
|
||||
}
|
||||
|
||||
/// Fetch webhook from Ref
|
||||
pub async fn as_webhook(&self, db: &Database) -> Result<Webhook> {
|
||||
db.fetch_webhook(&self.id).await
|
||||
|
||||
Reference in New Issue
Block a user