fix: ignore non administrator script setting
All checks were successful
Build / Build (push) Successful in 43s
Build / docker (push) Successful in 16s

This commit is contained in:
파링 2026-01-06 01:40:11 +09:00
parent 474e350d77
commit 18eba1d443
Signed by: paring
SSH key fingerprint: SHA256:8uCHhCpn/gVOLEaTolmbub9kfM6XBxWkIWmHxUZoWWk

View file

@ -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(());
};