html terminal
permissions
bendn 2023-08-16
parent eb10bc8 · commit 2a0ce1b
-rw-r--r--Cargo.toml2
-rw-r--r--rust-toolchain.toml2
-rw-r--r--src/bot/admin.rs16
-rw-r--r--src/bot/bans.rs16
-rw-r--r--src/bot/config.rs8
-rw-r--r--src/bot/mod.rs4
-rw-r--r--src/bot/voting.rs9
7 files changed, 49 insertions, 8 deletions
diff --git a/Cargo.toml b/Cargo.toml
index cc0b319..ad45e9d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -30,7 +30,7 @@ serenity = { version = "0.11.5", features = [
"gateway",
], default-features = false }
poise = "0.5.5"
-anyhow = "1.0.71"
+anyhow = "=1.0.72"
regex = { version = "1.8.4", features = ["std"], default-features = false }
minify-js = "0.5.6"
itertools = "0.10.5"
diff --git a/rust-toolchain.toml b/rust-toolchain.toml
index 5d56faf..0bd7bc6 100644
--- a/rust-toolchain.toml
+++ b/rust-toolchain.toml
@@ -1,2 +1,2 @@
[toolchain]
-channel = "nightly"
+channel = "nightly-2023-08-03"
diff --git a/src/bot/admin.rs b/src/bot/admin.rs
index b8b919b..404ab1b 100644
--- a/src/bot/admin.rs
+++ b/src/bot/admin.rs
@@ -2,7 +2,13 @@ use super::{Context, Result};
use crate::bot::player::{self, Players};
use crate::send_ctx;
-#[poise::command(slash_command, category = "Configuration", rename = "add_admin")]
+#[poise::command(
+ slash_command,
+ category = "Configuration",
+ rename = "add_admin",
+ required_permissions = "ADMINISTRATOR",
+ default_member_permissions = "ADMINISTRATOR"
+)]
/// make somebody a admin
pub async fn add(
ctx: Context<'_>,
@@ -18,7 +24,13 @@ pub async fn add(
Ok(())
}
-#[poise::command(slash_command, category = "Configuration", rename = "remove_admin")]
+#[poise::command(
+ slash_command,
+ category = "Configuration",
+ rename = "remove_admin",
+ required_permissions = "ADMINISTRATOR",
+ default_member_permissions = "ADMINISTRATOR"
+)]
/// remove the admin status
pub async fn remove(
ctx: Context<'_>,
diff --git a/src/bot/bans.rs b/src/bot/bans.rs
index 96d101d..89266c6 100644
--- a/src/bot/bans.rs
+++ b/src/bot/bans.rs
@@ -2,7 +2,13 @@ use super::{Context, Result};
use crate::bot::player::{self, Players};
use crate::{return_next, send_ctx};
-#[poise::command(slash_command, category = "Control", rename = "ban")]
+#[poise::command(
+ slash_command,
+ category = "Control",
+ rename = "ban",
+ required_permissions = "ADMINISTRATOR",
+ default_member_permissions = "ADMINISTRATOR"
+)]
/// ban a player by uuid and ip
pub async fn add(
ctx: Context<'_>,
@@ -20,7 +26,13 @@ pub async fn add(
return_next!(ctx)
}
-#[poise::command(slash_command, category = "Control", rename = "unban")]
+#[poise::command(
+ slash_command,
+ category = "Control",
+ rename = "unban",
+ default_member_permissions = "ADMINISTRATOR",
+ required_permissions = "ADMINISTRATOR"
+)]
/// unban a player by uuid or ip
pub async fn remove(
ctx: Context<'_>,
diff --git a/src/bot/config.rs b/src/bot/config.rs
index 78a0da3..9bcee22 100644
--- a/src/bot/config.rs
+++ b/src/bot/config.rs
@@ -39,7 +39,13 @@ async fn complete<'a>(
.map(|name| name.from_case(Case::Camel).to_case(Case::Lower))
}
-#[poise::command(slash_command, category = "Configuration", rename = "config")]
+#[poise::command(
+ slash_command,
+ category = "Configuration",
+ rename = "config",
+ default_member_permissions = "ADMINISTRATOR",
+ required_permissions = "ADMINISTRATOR"
+)]
/// change a setting
pub async fn set(
ctx: Context<'_>,
diff --git a/src/bot/mod.rs b/src/bot/mod.rs
index b56c23c..45c9935 100644
--- a/src/bot/mod.rs
+++ b/src/bot/mod.rs
@@ -161,6 +161,7 @@ async fn on_error(error: poise::FrameworkError<'_, Data, anyhow::Error>) {
#[poise::command(
prefix_command,
required_permissions = "ADMINISTRATOR",
+ default_member_permissions = "ADMINISTRATOR",
category = "Control",
track_edits
)]
@@ -199,6 +200,7 @@ async fn get_nextblock() -> String {
#[poise::command(
slash_command,
category = "Control",
+ default_member_permissions = "ADMINISTRATOR",
required_permissions = "ADMINISTRATOR"
)]
/// say something as the server
@@ -225,6 +227,7 @@ fn strip_colors(from: &str) -> String {
#[poise::command(
slash_command,
+ default_member_permissions = "ADMINISTRATOR",
required_permissions = "ADMINISTRATOR",
category = "Control"
)]
@@ -242,6 +245,7 @@ pub async fn start(
#[poise::command(
slash_command,
category = "Control",
+ default_member_permissions = "ADMINISTRATOR",
required_permissions = "ADMINISTRATOR"
)]
/// end the game.
diff --git a/src/bot/voting.rs b/src/bot/voting.rs
index 1521284..0c55682 100644
--- a/src/bot/voting.rs
+++ b/src/bot/voting.rs
@@ -397,7 +397,13 @@ where
}
}
-#[poise::command(slash_command, category = "Discord", rename = "create_vote")]
+#[poise::command(
+ slash_command,
+ category = "Discord",
+ rename = "create_vote",
+ default_member_permissions = "ADMINISTRATOR",
+ required_permissions = "ADMINISTRATOR"
+)]
/// make a vote
pub async fn create(
ctx: Context<'_>,
@@ -474,6 +480,7 @@ async fn fix(ctx: &Context<'_>, data: BufReader<std::fs::File>) -> Result<()> {
#[poise::command(
slash_command,
category = "Discord",
+ default_member_permissions = "ADMINISTRATOR",
required_permissions = "ADMINISTRATOR"
)]
pub async fn fixall(ctx: Context<'_>) -> Result<()> {