From 90f05758d00cd61ef86cbc9c4a93124154a3de6a Mon Sep 17 00:00:00 2001 From: jude Date: Sat, 24 Feb 2024 22:27:29 +0000 Subject: [PATCH] Bypass self permission check for DMs --- Cargo.lock | 2 +- Cargo.toml | 4 ++-- src/hooks.rs | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index efeadd9..63b2257 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2358,7 +2358,7 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "reminder-rs" -version = "1.7.0-rc2" +version = "1.7.0-rc3" dependencies = [ "base64 0.21.7", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 8f7006b..7d97a21 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "reminder-rs" -version = "1.7.0-rc2" +version = "1.7.0-rc3" authors = ["Jude Southworth "] edition = "2021" license = "AGPL-3.0 only" @@ -54,7 +54,7 @@ assets = [ ["web/static/webfonts/*", "lib/reminder-rs/static/webfonts", "644"], ["web/static/site.webmanifest", "lib/reminder-rs/static/site.webmanifest", "644"], ["web/templates/**/*", "lib/reminder-rs/templates", "644"], - ["reminder-dashboard/dist/static/assets", "lib/reminder-rs/static/assets", "644"], + ["reminder-dashboard/dist/static/assets/*", "lib/reminder-rs/static/assets", "644"], ["reminder-dashboard/dist/index.html", "lib/reminder-rs/static/index.html", "644"], ["conf/default.env", "etc/reminder-rs/config.env", "600"], ["conf/Rocket.toml", "etc/reminder-rs/Rocket.toml", "600"], diff --git a/src/hooks.rs b/src/hooks.rs index e74430f..5e1c2e8 100644 --- a/src/hooks.rs +++ b/src/hooks.rs @@ -59,6 +59,11 @@ async fn macro_check(ctx: Context<'_>) -> bool { async fn check_self_permissions(ctx: Context<'_>) -> bool { let user_id = ctx.serenity_context().cache.current_user().id; + // DM permissions are always fine + if ctx.guild_id().is_none() { + return true; + } + let (view_channel, send_messages, embed_links, manage_webhooks) = ctx .channel_id() .to_channel(&ctx)