This commit is contained in:
parent
1b6edcced4
commit
2f989b25b4
3 changed files with 34 additions and 17 deletions
37
Dockerfile
37
Dockerfile
|
|
@ -1,20 +1,35 @@
|
||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
|
FROM rust:alpine AS chef
|
||||||
FROM rust:alpine as builder
|
RUN apk add --no-cache openssl-dev musl-dev openssl-libs-static lld git g++ make
|
||||||
|
RUN cargo install cargo-chef
|
||||||
RUN apk add openssl-dev musl-dev openssl-libs-static lld git
|
|
||||||
|
|
||||||
WORKDIR /app
|
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 . .
|
COPY . .
|
||||||
|
|
||||||
RUN git submodule update --init
|
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
|
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
||||||
|
--mount=type=cache,target=/app/target \
|
||||||
FROM scratch as final
|
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
|
WORKDIR /app
|
||||||
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/professor ./splatie
|
COPY --from=builder /app/dist/professor ./splatie
|
||||||
|
|
||||||
ENTRYPOINT ["./splatie"]
|
ENTRYPOINT ["./splatie"]
|
||||||
|
|
@ -13,7 +13,7 @@ use std::env;
|
||||||
async fn main() {
|
async fn main() {
|
||||||
dotenv::dotenv().ok();
|
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 intents = GatewayIntents::GUILD_MESSAGES | GatewayIntents::MESSAGE_CONTENT;
|
||||||
|
|
||||||
let mut client = Client::builder(&token, intents)
|
let mut client = Client::builder(&token, intents)
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ pub struct MiiverseModApplicationHandler{
|
||||||
impl EventHandler for MiiverseModApplicationHandler {
|
impl EventHandler for MiiverseModApplicationHandler {
|
||||||
async fn ready(&self, ctx: Context, data_about_bot: Ready) {
|
async fn ready(&self, ctx: Context, data_about_bot: Ready) {
|
||||||
let command = CreateCommand::new("miivserse-mod-application")
|
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");
|
let cmd = Command::create_global_command(&ctx.http, command).await.expect("unable to register command");
|
||||||
|
|
||||||
|
|
@ -32,10 +32,11 @@ impl EventHandler for MiiverseModApplicationHandler {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let modal = CreateQuickModal::new("Miiverse Moderator Application Form")
|
let modal = CreateQuickModal::new("Moderator Application Form")
|
||||||
.short_field("Whats your timezone?")
|
.short_field("What is your timezone?")
|
||||||
.short_field("How long are you usually availible every day?")
|
.short_field("How long are you usually availible every day?")
|
||||||
.paragraph_field("Why should we pick you?");
|
.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{
|
let response = match cmd.quick_modal(&ctx, modal).await{
|
||||||
Ok(v) => v,
|
Ok(v) => v,
|
||||||
|
|
@ -49,19 +50,20 @@ impl EventHandler for MiiverseModApplicationHandler {
|
||||||
response.interaction.create_response(&ctx.http, CreateInteractionResponse::Message(
|
response.interaction.create_response(&ctx.http, CreateInteractionResponse::Message(
|
||||||
CreateInteractionResponseMessage::new()
|
CreateInteractionResponseMessage::new()
|
||||||
.ephemeral(true)
|
.ephemeral(true)
|
||||||
.content("application has been sent")
|
.content("Application has been sent!")
|
||||||
)).await.ok();
|
)).await.ok();
|
||||||
|
|
||||||
|
|
||||||
let emergency_channel = ChannelId::new(1324479126991802528);
|
let emergency_channel = ChannelId::new(1504018819071610970);
|
||||||
|
|
||||||
let mut author = CreateEmbedAuthor::from(response.interaction.user);
|
let mut author = CreateEmbedAuthor::from(response.interaction.user);
|
||||||
|
|
||||||
let embed = CreateEmbed::new()
|
let embed = CreateEmbed::new()
|
||||||
.title("New Miiverse application")
|
.title("Moderator Application")
|
||||||
.field("Whats your timezone?", &response.inputs[0], false)
|
.field("Whats your timezone?", &response.inputs[0], false)
|
||||||
.field("How long are you usually availible every day?", &response.inputs[1], 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("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())
|
.timestamp(Timestamp::now())
|
||||||
.author(author)
|
.author(author)
|
||||||
.color(Colour::DARK_GREEN);
|
.color(Colour::DARK_GREEN);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue