Bypass self permission check for DMs

This commit is contained in:
jude 2024-02-24 22:27:29 +00:00
parent 74b7b5d711
commit 90f05758d0
3 changed files with 8 additions and 3 deletions

2
Cargo.lock generated
View File

@ -2358,7 +2358,7 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
[[package]] [[package]]
name = "reminder-rs" name = "reminder-rs"
version = "1.7.0-rc2" version = "1.7.0-rc3"
dependencies = [ dependencies = [
"base64 0.21.7", "base64 0.21.7",
"chrono", "chrono",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "reminder-rs" name = "reminder-rs"
version = "1.7.0-rc2" version = "1.7.0-rc3"
authors = ["Jude Southworth <judesouthworth@pm.me>"] authors = ["Jude Southworth <judesouthworth@pm.me>"]
edition = "2021" edition = "2021"
license = "AGPL-3.0 only" license = "AGPL-3.0 only"
@ -54,7 +54,7 @@ assets = [
["web/static/webfonts/*", "lib/reminder-rs/static/webfonts", "644"], ["web/static/webfonts/*", "lib/reminder-rs/static/webfonts", "644"],
["web/static/site.webmanifest", "lib/reminder-rs/static/site.webmanifest", "644"], ["web/static/site.webmanifest", "lib/reminder-rs/static/site.webmanifest", "644"],
["web/templates/**/*", "lib/reminder-rs/templates", "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"], ["reminder-dashboard/dist/index.html", "lib/reminder-rs/static/index.html", "644"],
["conf/default.env", "etc/reminder-rs/config.env", "600"], ["conf/default.env", "etc/reminder-rs/config.env", "600"],
["conf/Rocket.toml", "etc/reminder-rs/Rocket.toml", "600"], ["conf/Rocket.toml", "etc/reminder-rs/Rocket.toml", "600"],

View File

@ -59,6 +59,11 @@ async fn macro_check(ctx: Context<'_>) -> bool {
async fn check_self_permissions(ctx: Context<'_>) -> bool { async fn check_self_permissions(ctx: Context<'_>) -> bool {
let user_id = ctx.serenity_context().cache.current_user().id; 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 let (view_channel, send_messages, embed_links, manage_webhooks) = ctx
.channel_id() .channel_id()
.to_channel(&ctx) .to_channel(&ctx)