diff --git a/Dockerfile b/Dockerfile index 3bb5933..77e8ef8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,35 @@ # syntax=docker/dockerfile:1 - -FROM rust:alpine as builder - -RUN apk add openssl-dev musl-dev openssl-libs-static lld git - +FROM rust:alpine AS chef +RUN apk add --no-cache openssl-dev musl-dev openssl-libs-static lld git g++ make +RUN cargo install cargo-chef WORKDIR /app +FROM chef AS planner +COPY . . +RUN git submodule update --init +RUN cargo chef prepare --recipe-path recipe.json + +FROM chef AS builder +COPY --from=planner /app/recipe.json recipe.json + +ENV OPENSSL_LIB_DIR=/usr/lib +ENV OPENSSL_INCLUDE_DIR=/usr/include/openssl +ENV OPENSSL_STATIC=1 + +RUN --mount=type=cache,target=/usr/local/cargo/registry \ + --mount=type=cache,target=/app/target \ + cargo chef cook --release --recipe-path recipe.json --target x86_64-unknown-linux-musl + COPY . . - RUN git submodule update --init -RUN OPENSSL_LIB_DIR=/usr/lib OPENSSL_INCLUDE_DIR=/usr/include/openssl OPENSSL_STATIC=1 cargo build --release --target x86_64-unknown-linux-musl - -FROM scratch as final +RUN --mount=type=cache,target=/usr/local/cargo/registry \ + --mount=type=cache,target=/app/target \ + cargo build --release --target x86_64-unknown-linux-musl && \ + mkdir -p /app/dist && \ + cp /app/target/x86_64-unknown-linux-musl/release/professor /app/dist/ +FROM scratch AS final WORKDIR /app -COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/professor ./splatie - -ENTRYPOINT ["./splatie"] +COPY --from=builder /app/dist/professor ./splatie +ENTRYPOINT ["./splatie"] \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 51f086a..7b2f043 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,7 +13,7 @@ use std::env; async fn main() { dotenv::dotenv().ok(); - let token = env::var("PROFESSOR_TOKEN").expect("Token not specified"); + let token = env::var("SPACEBOT_TOKEN").expect("Token not specified"); let intents = GatewayIntents::GUILD_MESSAGES | GatewayIntents::MESSAGE_CONTENT; let mut client = Client::builder(&token, intents) diff --git a/src/miiverse_mod_application.rs b/src/miiverse_mod_application.rs index fff062d..5d80e2c 100644 --- a/src/miiverse_mod_application.rs +++ b/src/miiverse_mod_application.rs @@ -12,7 +12,7 @@ pub struct MiiverseModApplicationHandler{ impl EventHandler for MiiverseModApplicationHandler { async fn ready(&self, ctx: Context, data_about_bot: Ready) { let command = CreateCommand::new("miivserse-mod-application") - .description("Apply for miiverse moderator"); + .description("Apply for moderator"); let cmd = Command::create_global_command(&ctx.http, command).await.expect("unable to register command"); @@ -32,10 +32,11 @@ impl EventHandler for MiiverseModApplicationHandler { return; } - let modal = CreateQuickModal::new("Miiverse Moderator Application Form") - .short_field("Whats your timezone?") + let modal = CreateQuickModal::new("Moderator Application Form") + .short_field("What is your timezone?") .short_field("How long are you usually availible every day?") .paragraph_field("Why should we pick you?"); + .paragraph_field("What could you contribute to the mod team?") let response = match cmd.quick_modal(&ctx, modal).await{ Ok(v) => v, @@ -49,19 +50,20 @@ impl EventHandler for MiiverseModApplicationHandler { response.interaction.create_response(&ctx.http, CreateInteractionResponse::Message( CreateInteractionResponseMessage::new() .ephemeral(true) - .content("application has been sent") + .content("Application has been sent!") )).await.ok(); - let emergency_channel = ChannelId::new(1324479126991802528); + let emergency_channel = ChannelId::new(1504018819071610970); let mut author = CreateEmbedAuthor::from(response.interaction.user); let embed = CreateEmbed::new() - .title("New Miiverse application") + .title("Moderator Application") .field("Whats your timezone?", &response.inputs[0], false) .field("How long are you usually availible every day?", &response.inputs[1], false) .field("Why should we pick you?", &response.inputs[2], false) + .field("What could you contribute to the mod team?", &response.inputs[3], false) .timestamp(Timestamp::now()) .author(author) .color(Colour::DARK_GREEN);