Skip to content

Commit

Permalink
Merge pull request #200 from marcelropos/setup-command
Browse files Browse the repository at this point in the history
Setup command
  • Loading branch information
maxwai authored Mar 2, 2024
2 parents a0e2646 + 3269dbe commit 508892e
Show file tree
Hide file tree
Showing 5 changed files with 2,204 additions and 15 deletions.
22 changes: 22 additions & 0 deletions src/bot/commands.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::time::SystemTime;

use poise::serenity_prelude::{GuildChannel, Role};
use poise::CreateReply;
use tracing::info;

Expand All @@ -10,6 +11,8 @@ use crate::{

use super::checks;

mod setup;

/// ping command
#[poise::command(slash_command, prefix_command)]
pub async fn ping(ctx: Context<'_>) -> Result<(), Error> {
Expand Down Expand Up @@ -98,3 +101,22 @@ pub async fn shutdown(ctx: Context<'_>) -> Result<(), Error> {

Ok(())
}

/// admin-only. Enter setup mode, either new server setup or edit setup information
#[poise::command(prefix_command, invoke_on_edit, reuse_response, guild_only)]
pub async fn setup(
ctx: Context<'_>,
role_mention: Option<Role>,
channel_mention: Option<GuildChannel>,
flag: Option<bool>,
number: Option<u32>,
#[rest] rest: Option<String>,
) -> Result<(), Error> {
// Check permissions
if !checks::is_owner(ctx).await && !checks::is_admin(ctx).await {
ctx.say("Missing permissions, requires admin permissions")
.await?;
return Ok(());
}
setup::setup(ctx, role_mention, channel_mention, flag, number, rest).await
}
Loading

0 comments on commit 508892e

Please sign in to comment.