fix: ignore non administrator script setting
This commit is contained in:
parent
474e350d77
commit
18eba1d443
1 changed files with 11 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
use anyhow::Context as _;
|
use anyhow::Context as _;
|
||||||
use serenity::all::{
|
use serenity::all::{
|
||||||
Component, Context, CreateInteractionResponseMessage, Label, LabelComponent, ModalInteraction,
|
Component, Context, CreateInteractionResponseMessage, Label, LabelComponent, ModalInteraction,
|
||||||
|
Permissions,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{db, handler::Handler};
|
use crate::{db, handler::Handler};
|
||||||
|
|
@ -23,6 +24,16 @@ impl Handler {
|
||||||
ctx: &Context,
|
ctx: &Context,
|
||||||
interaction: &ModalInteraction,
|
interaction: &ModalInteraction,
|
||||||
) -> anyhow::Result<()> {
|
) -> 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 {
|
let Some(guild_id) = interaction.guild_id else {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue