feat(miiverse-mod-apps): add miiverse moderator applications
This commit is contained in:
parent
162a1420db
commit
d92125e39f
3 changed files with 31 additions and 9 deletions
|
|
@ -10,6 +10,7 @@ debug = "none"
|
|||
debug-assertions = false
|
||||
strip = true
|
||||
panic = "abort"
|
||||
lto = "fat"
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue