diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-04 01:08:08 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-04 01:08:08 +0100 |
| commit | 8e6fced543735aa4c68e70221518a37c36780d59 (patch) | |
| tree | 7b7e6be03c3091caf2ae7bed12b40b6d6f1e71e5 /src/commands/trigger.rs | |
| parent | utilities: sanitize filenames and isolate temp operations (diff) | |
| download | senator-sperma-8e6fced543735aa4c68e70221518a37c36780d59.tar.gz senator-sperma-8e6fced543735aa4c68e70221518a37c36780d59.zip | |
commands: gate admin, trigger, cron and recording behind permissions
Diffstat (limited to 'src/commands/trigger.rs')
| -rw-r--r-- | src/commands/trigger.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/commands/trigger.rs b/src/commands/trigger.rs index 2a33528..3a91edd 100644 --- a/src/commands/trigger.rs +++ b/src/commands/trigger.rs | |||
| @@ -11,6 +11,8 @@ type Context<'a> = poise::Context<'a, Data, Error>; | |||
| 11 | /// Trigger keyword management | 11 | /// Trigger keyword management |
| 12 | #[poise::command( | 12 | #[poise::command( |
| 13 | slash_command, | 13 | slash_command, |
| 14 | guild_only, | ||
| 15 | required_permissions = "MANAGE_GUILD", | ||
| 14 | subcommands("create", "add", "remove", "delete", "list", "help",) | 16 | subcommands("create", "add", "remove", "delete", "list", "help",) |
| 15 | )] | 17 | )] |
| 16 | pub async fn trigger(_ctx: Context<'_>) -> Result<()> { | 18 | pub async fn trigger(_ctx: Context<'_>) -> Result<()> { |
| @@ -18,7 +20,7 @@ pub async fn trigger(_ctx: Context<'_>) -> Result<()> { | |||
| 18 | } | 20 | } |
| 19 | 21 | ||
| 20 | /// Create a new trigger group | 22 | /// Create a new trigger group |
| 21 | #[poise::command(slash_command)] | 23 | #[poise::command(slash_command, guild_only, required_permissions = "MANAGE_GUILD")] |
| 22 | pub async fn create( | 24 | pub async fn create( |
| 23 | ctx: Context<'_>, | 25 | ctx: Context<'_>, |
| 24 | #[description = "Logical group name"] | 26 | #[description = "Logical group name"] |
| @@ -38,7 +40,7 @@ pub async fn create( | |||
| 38 | } | 40 | } |
| 39 | 41 | ||
| 40 | /// Add keywords and/or responses to a trigger group | 42 | /// Add keywords and/or responses to a trigger group |
| 41 | #[poise::command(slash_command)] | 43 | #[poise::command(slash_command, guild_only, required_permissions = "MANAGE_GUILD")] |
| 42 | pub async fn add( | 44 | pub async fn add( |
| 43 | ctx: Context<'_>, | 45 | ctx: Context<'_>, |
| 44 | #[description = "Existing group name"] | 46 | #[description = "Existing group name"] |
| @@ -79,7 +81,7 @@ pub async fn add( | |||
| 79 | } | 81 | } |
| 80 | 82 | ||
| 81 | /// Remove keyword or response from a group | 83 | /// Remove keyword or response from a group |
| 82 | #[poise::command(slash_command)] | 84 | #[poise::command(slash_command, guild_only, required_permissions = "MANAGE_GUILD")] |
| 83 | pub async fn remove( | 85 | pub async fn remove( |
| 84 | ctx: Context<'_>, | 86 | ctx: Context<'_>, |
| 85 | #[description = "Group name"] | 87 | #[description = "Group name"] |
| @@ -110,7 +112,7 @@ pub async fn remove( | |||
| 110 | } | 112 | } |
| 111 | 113 | ||
| 112 | /// Delete an entire trigger group | 114 | /// Delete an entire trigger group |
| 113 | #[poise::command(slash_command)] | 115 | #[poise::command(slash_command, guild_only, required_permissions = "MANAGE_GUILD")] |
| 114 | pub async fn delete( | 116 | pub async fn delete( |
| 115 | ctx: Context<'_>, | 117 | ctx: Context<'_>, |
| 116 | #[description = "Group name"] | 118 | #[description = "Group name"] |
| @@ -128,7 +130,7 @@ pub async fn delete( | |||
| 128 | } | 130 | } |
| 129 | 131 | ||
| 130 | /// List keywords and responses for a group | 132 | /// List keywords and responses for a group |
| 131 | #[poise::command(slash_command)] | 133 | #[poise::command(slash_command, guild_only, required_permissions = "MANAGE_GUILD")] |
| 132 | pub async fn list( | 134 | pub async fn list( |
| 133 | ctx: Context<'_>, | 135 | ctx: Context<'_>, |
| 134 | #[description = "Group name"] | 136 | #[description = "Group name"] |
| @@ -178,7 +180,7 @@ pub async fn list( | |||
| 178 | } | 180 | } |
| 179 | 181 | ||
| 180 | /// Display trigger command usage info | 182 | /// Display trigger command usage info |
| 181 | #[poise::command(slash_command)] | 183 | #[poise::command(slash_command, guild_only, required_permissions = "MANAGE_GUILD")] |
| 182 | pub async fn help(ctx: Context<'_>) -> Result<()> { | 184 | pub async fn help(ctx: Context<'_>) -> Result<()> { |
| 183 | let help = [ | 185 | let help = [ |
| 184 | "**Trigger Commands**", | 186 | "**Trigger Commands**", |
