Skip to content

Commit

Permalink
[Bot] Test bot commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Marten-Mrfc committed Nov 20, 2024
1 parent 42dbebc commit 1e5c436
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
40 changes: 40 additions & 0 deletions discord_bot/src/discord/follow_up.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
use crate::{check_is_support, Context, WinstonError};
use poise::CreateReply;
use std::fmt::{self, Display, Formatter};

#[derive(Debug, poise::ChoiceParameter)]
pub enum Message {
#[doc = "mclogs"]
McLogs,
#[doc = "somethingelse"]
Somethingelse,
#[doc = "idk"]
Idk,
}

impl Display for Message {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
match self {
Message::McLogs => write!(f, "mclogs"),
Message::Somethingelse => write!(f, "somethingelse"),
Message::Idk => write!(f, "idk"),
_ => write!(f, "unknown message type"),
}
}
}

#[poise::command(
slash_command,
ephemeral,
check = "check_is_support"
)]
pub async fn support(
ctx: Context<'_>,
#[description = "The reason for closing the ticket"] reason: Message,
) -> Result<(), WinstonError> {
let _handle = ctx
.send(CreateReply::default().content(format! ("Reason: {reason}")))
.await?;

Ok(())
}
3 changes: 2 additions & 1 deletion discord_bot/src/discord/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mod thread_cleanup;
mod thread_closed_blocker;
mod thread_support_answering;
mod ticket_reopen;

mod follow_up;
pub use close_ticket::*;
pub use create_task::*;
pub use post_in_questions::*;
Expand All @@ -17,3 +17,4 @@ pub use thread_cleanup::*;
pub use thread_closed_blocker::*;
pub use thread_support_answering::*;
pub use ticket_reopen::*;
pub use follow_up::*;
1 change: 1 addition & 0 deletions discord_bot/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ async fn startup_discord_bot() {
post_in_questions(),
post_bug_in_questions(),
post_suggestion_in_questions(),
support(),
],
on_error: |error| Box::pin(on_error(error)),
..Default::default()
Expand Down

0 comments on commit 1e5c436

Please sign in to comment.