use poise::{serenity_prelude::CreateEmbed, CreateReply};
use serde::{Deserialize, Serialize};

use crate::{
    consts::THEME_COLOR,
    utils::{footer, Extract, Recordable},
    Context, Error,
};

#[derive(Serialize, Deserialize, Extract)]
pub struct Options;

impl Recordable for Options {
    async fn run(self, ctx: Context<'_>) -> Result<(), Error> {
        let footer = footer(ctx);

        ctx.send(CreateReply::default().embed(CreateEmbed::new().title("Donate")
            .description("Thinking of adding a monthly contribution?
Click below for my Patreon and official bot server :)

**https://www.patreon.com/jellywx/**
**https://discord.jellywx.com/**

When you subscribe, Patreon will automatically give you a role on the Discord server (make sure you link your Patreon and Discord accounts!)
With your new rank, you'll be able to:
• Set repeating reminders with `/remind` or the dashboard
• Use unlimited uploads on SoundFX

(Also, members of servers you __own__ will be able to set repeating reminders via commands)

Just $2 USD/month!

*Please note, you must be in the JellyWX Discord server to receive Patreon features*")
                .footer(footer)
                .color(*THEME_COLOR)
        ),
    )
    .await?;

        Ok(())
    }
}

/// Details on supporting the bot and Patreon benefits
#[poise::command(slash_command, rename = "patreon", identifying_name = "patreon")]
pub async fn command(ctx: Context<'_>) -> Result<(), Error> {
    (Options {}).run(ctx).await
}
