From 18eba1d443579fe6acb43496f61e18969497de38 Mon Sep 17 00:00:00 2001 From: paring Date: Tue, 6 Jan 2026 01:40:11 +0900 Subject: [PATCH] fix: ignore non administrator script setting --- src/bot/modal.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/bot/modal.rs b/src/bot/modal.rs index 5467812..4c0348d 100644 --- a/src/bot/modal.rs +++ b/src/bot/modal.rs @@ -1,6 +1,7 @@ use anyhow::Context as _; use serenity::all::{ Component, Context, CreateInteractionResponseMessage, Label, LabelComponent, ModalInteraction, + Permissions, }; use crate::{db, handler::Handler}; @@ -23,6 +24,16 @@ impl Handler { ctx: &Context, interaction: &ModalInteraction, ) -> anyhow::Result<()> { + if !interaction + .member + .as_ref() + .and_then(|x| x.permissions) + .map(|x| x.contains(Permissions::ADMINISTRATOR)) + .unwrap_or(false) + { + return Ok(()); + } + let Some(guild_id) = interaction.guild_id else { return Ok(()); };