html terminal
Diffstat (limited to 'src/bot/admin.rs')
-rw-r--r--src/bot/admin.rs35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/bot/admin.rs b/src/bot/admin.rs
new file mode 100644
index 0000000..b8b919b
--- /dev/null
+++ b/src/bot/admin.rs
@@ -0,0 +1,35 @@
+use super::{Context, Result};
+use crate::bot::player::{self, Players};
+use crate::send_ctx;
+
+#[poise::command(slash_command, category = "Configuration", rename = "add_admin")]
+/// make somebody a admin
+pub async fn add(
+ ctx: Context<'_>,
+ #[description = "The player to make admin"]
+ #[autocomplete = "player::autocomplete"]
+ player: String,
+) -> Result<()> {
+ let player = Players::find(&ctx.data().stdin, player)
+ .await
+ .unwrap()
+ .unwrap();
+ send_ctx!(ctx, "admin add {}", player.uuid)?;
+ Ok(())
+}
+
+#[poise::command(slash_command, category = "Configuration", rename = "remove_admin")]
+/// remove the admin status
+pub async fn remove(
+ ctx: Context<'_>,
+ #[description = "The player to remove admin status from"]
+ #[autocomplete = "player::autocomplete"]
+ player: String,
+) -> Result<()> {
+ let player = Players::find(&ctx.data().stdin, player)
+ .await
+ .unwrap()
+ .unwrap();
+ send_ctx!(ctx, "admin remove {}", player.uuid)?;
+ Ok(())
+}