Skip to content

Commit

Permalink
Update shuttle to 0.27.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jdh8 committed Sep 24, 2023
1 parent c495be2 commit f9c3360
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
7 changes: 3 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ rand = "0.8.5"
regex = "1.9.5"
reqwest = "0.11.20"
serde_json = "1.0.105"
shuttle-poise = "0.26.0"
shuttle-runtime = "0.26.0"
shuttle-secrets = "0.26.0"
shuttle-static-folder = "0.26.0"
shuttle-poise = "0.27.0"
shuttle-runtime = "0.27.0"
shuttle-secrets = "0.27.0"
strum = { version = "0.25", features = ["derive"] }
tokio = { version = "1.32.0", features = ["full"] }
tree_magic_mini = "3.0.3"
Expand Down
6 changes: 2 additions & 4 deletions src/fun/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ pub async fn cupcake(ctx: Context<'_>,
) -> anyhow::Result<()> {
let target = user.as_ref().unwrap_or_else(|| ctx.author());
let face = face_image(target).await?.resize(128, 128, CatmullRom);
let path = ctx.data().assets.as_path().join("290px-Hostess-Cupcake-Whole.jpg");
let cake = image::open(path)?.into_rgba8();
let cake = image::open("assets/290px-Hostess-Cupcake-Whole.jpg")?.into_rgba8();
let cake: image::RgbImage = blend_image(cake, &face, 80, 80).convert();
let cake = webp::Encoder::from_rgb(&cake, cake.width(), cake.height());

Expand Down Expand Up @@ -210,8 +209,7 @@ pub async fn ship(ctx: Context<'_>,
}

async fn fuck(ctx: Context<'_>, user: Option<&serenity::User>) -> anyhow::Result<()> {
let path = ctx.data().assets.as_path().join("566424ede431200e3985ca6f21287cee.png");
let base = image::open(path)?.into_rgba8();
let base = image::open("assets/566424ede431200e3985ca6f21287cee.png")?.into_rgba8();
let author = face_image(ctx.author()).await?.resize(256, 256, CatmullRom);
let image = blend_image(base, &author, 364, 120);
let image: image::RgbImage = match user {
Expand Down
10 changes: 3 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@ mod tools;
mod weeb;
mod topgg;
use poise::serenity_prelude as serenity;
use std::path::PathBuf;

#[macro_export]
macro_rules! bot_id {
() => { 410_315_411_695_992_833 };
}

#[derive(Debug, Default, Clone, PartialEq, Eq)]
pub struct Data {
assets: PathBuf,
}
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
pub struct Data;

type Context<'a> = poise::Context<'a, Data, anyhow::Error>;

Expand Down Expand Up @@ -62,7 +59,6 @@ fn get_commands() -> Vec<poise::Command<Data, anyhow::Error>> {

#[shuttle_runtime::main]
async fn main(
#[shuttle_static_folder::StaticFolder(folder = "assets")] path: PathBuf,
#[shuttle_secrets::Secrets] secrets: shuttle_secrets::SecretStore,
) -> shuttle_poise::ShuttlePoise<Data, anyhow::Error> {
let poster = topgg::Poster::new(secrets.get("TOP_GG_TOKEN"));
Expand All @@ -84,7 +80,7 @@ async fn main(
},
None => poise::builtins::register_globally(ctx, commands).await?,
};
Ok(Data { assets: path })
Ok(Data)
})
})
.client_settings(|client| client.event_handler(poster));
Expand Down

0 comments on commit f9c3360

Please sign in to comment.