diff --git a/Cargo.toml b/Cargo.toml index 14abdcb..1121e1d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,7 @@ debug = "none" debug-assertions = false strip = true panic = "abort" +lto = "fat" diff --git a/src/main.rs b/src/main.rs index c0638e1..eddc32d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -30,7 +30,7 @@ async fn main() { .event_handler(cheeseburger::CheeseburgerHandler) .event_handler(too_fat::TooFatHandler) .event_handler(emergency_report::EmergencyReportHandler::default()) - //.event_handler(miiverse_mod_application::MiiverseModApplicationHandler::default()) + .event_handler(miiverse_mod_application::MiiverseModApplicationHandler::default()) .await.expect("unable to create client"); client.start().await.expect("error running bot"); diff --git a/src/miiverse_mod_application.rs b/src/miiverse_mod_application.rs index ac6a6f0..7f456de 100644 --- a/src/miiverse_mod_application.rs +++ b/src/miiverse_mod_application.rs @@ -1,6 +1,6 @@ use crate::cheeseburger::CheeseburgerHandler; -use serenity::all::{ActivityData, ActivityType, Command, CommandId, Context, CreateCommand, CreateInputText, CreateQuickModal, EventHandler, Guild, GuildId, InputTextStyle, Interaction, Message, Ready}; +use serenity::all::{ActivityData, ActivityType, ChannelId, Colour, Command, CommandId, Context, CreateCommand, CreateEmbed, CreateEmbedAuthor, CreateInputText, CreateInteractionResponse, CreateInteractionResponseMessage, CreateMessage, CreateQuickModal, EventHandler, Guild, GuildId, InputTextStyle, Interaction, Message, Ready, Timestamp}; use serenity::async_trait; use tokio::sync::OnceCell; @@ -33,14 +33,10 @@ impl EventHandler for MiiverseModApplicationHandler { return; } - let main_field = CreateInputText::new( - InputTextStyle::Paragraph, - "Text", - "MAIN_CONTENT" - ); - let modal = CreateQuickModal::new("Miiverse Moderator Application Form") - .field(main_field); + .short_field("Whats your timezone?") + .short_field("How long are you usually availible every day?") + .paragraph_field("Why should we pick you?"); let response = match cmd.quick_modal(&ctx, modal).await{ Ok(v) => v, @@ -51,6 +47,31 @@ impl EventHandler for MiiverseModApplicationHandler { return }; + response.interaction.create_response(&ctx.http, CreateInteractionResponse::Message( + CreateInteractionResponseMessage::new() + .ephemeral(true) + .content("application has been sent") + )).await.ok(); + + + let emergency_channel = ChannelId::new(1324479126991802528); + + let mut author = CreateEmbedAuthor::from(response.interaction.user); + + let embed = CreateEmbed::new() + .title("New Miiverse 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) + .timestamp(Timestamp::now()) + .author(author) + .color(Colour::DARK_GREEN); + + let message = CreateMessage::new() + .add_embed(embed); + + emergency_channel.send_message(&ctx.http, message).await.ok(); + } }