Don't send attachments over API

This commit is contained in:
jude
2024-03-28 19:34:30 +00:00
parent 15dbed2f0f
commit 30f011fcd5
3 changed files with 53 additions and 22 deletions

View File

@ -146,9 +146,39 @@ pub struct EmbedField {
inline: bool,
}
#[derive(Serialize, Deserialize)]
pub struct Reminder {
#[derive(Deserialize)]
pub struct CreateReminder {
attachment: Option<Attachment>,
attachment_name: Option<String>,
avatar: Option<String>,
#[serde(with = "string")]
channel: u64,
content: String,
embed_author: String,
embed_author_url: Option<String>,
embed_color: u32,
embed_description: String,
embed_footer: String,
embed_footer_url: Option<String>,
embed_image_url: Option<String>,
embed_thumbnail_url: Option<String>,
embed_title: String,
embed_fields: Option<Json<Vec<EmbedField>>>,
enabled: bool,
expires: Option<NaiveDateTime>,
interval_seconds: Option<u32>,
interval_days: Option<u32>,
interval_months: Option<u32>,
#[serde(default = "name_default")]
name: String,
restartable: bool,
tts: bool,
username: Option<String>,
utc_time: NaiveDateTime,
}
#[derive(Serialize)]
pub struct GetReminder {
attachment_name: Option<String>,
avatar: Option<String>,
#[serde(with = "string")]
@ -363,7 +393,7 @@ pub(crate) async fn create_reminder(
transaction: &mut Transaction<'_>,
guild_id: GuildId,
user_id: UserId,
reminder: Reminder,
reminder: CreateReminder,
) -> JsonResult {
// check guild in db
match sqlx::query!("SELECT 1 as A FROM guilds WHERE guild = ?", guild_id.get())
@ -545,9 +575,9 @@ pub(crate) async fn create_reminder(
.await
{
Ok(_) => sqlx::query_as_unchecked!(
Reminder,
"SELECT
reminders.attachment,
GetReminder,
"
SELECT
reminders.attachment_name,
reminders.avatar,
channels.channel,