From 84e49527529097c5a0151a412db7e5bb4a69f9cd Mon Sep 17 00:00:00 2001 From: jude Date: Mon, 26 Oct 2020 12:33:38 +0000 Subject: [PATCH] moved the member-getter to as late as possible --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/framework.rs | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fe36d57..6ae3209 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1175,7 +1175,7 @@ dependencies = [ [[package]] name = "reminder_rs" -version = "1.0.2" +version = "1.1.0" dependencies = [ "Inflector", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index 20de0f5..51dd271 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "reminder_rs" -version = "1.0.2" +version = "1.1.0" authors = ["jellywx "] edition = "2018" diff --git a/src/framework.rs b/src/framework.rs index d1e895e..5fd58ca 100644 --- a/src/framework.rs +++ b/src/framework.rs @@ -349,8 +349,6 @@ impl Framework for RegexFramework { else if let (Some(guild), Some(Channel::Guild(channel))) = (msg.guild(&ctx).await, msg.channel(&ctx).await) { - let member = guild.member(&ctx, &msg.author).await.unwrap(); - if let Some(full_match) = self.command_matcher.captures(&msg.content) { if check_prefix(&ctx, &guild, full_match.name("prefix")).await { let pool = ctx @@ -370,6 +368,7 @@ impl Framework for RegexFramework { .commands .get(&full_match.name("cmd").unwrap().as_str().to_lowercase()) .unwrap(); + let channel_data = ChannelData::from_channel( msg.channel(&ctx).await.unwrap(), &pool, @@ -385,6 +384,8 @@ impl Framework for RegexFramework { .unwrap_or("") .to_string(); + let member = guild.member(&ctx, &msg.author).await.unwrap(); + if command.check_permissions(&ctx, &guild, &member).await { (command.func)(&ctx, &msg, args).await; } else if command.required_perms == PermissionLevel::Restricted