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 subscribing?
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

Members of servers you __own__ will be able to set repeating reminders via commands. You can also choose to share your membership with one other server.

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(())
    }
}

/// Show Patreon information
#[poise::command(slash_command, rename = "info", identifying_name = "patreon_info")]
pub async fn info(ctx: Context<'_>) -> Result<(), Error> {
    (Options {}).run(ctx).await
}
