if only setting one reminder with natural, show errors in messages. more refactor

This commit is contained in:
jude
2020-10-03 17:31:23 +01:00
parent 2b74adadeb
commit 836b77d14e
2 changed files with 88 additions and 32 deletions

View File

@ -8,13 +8,17 @@ mod time_parser;
mod consts;
use serenity::{
cache::Cache,
http::CacheHttp,
client::{
bridge::gateway::GatewayIntents,
Client,
},
model::id::{
GuildId, UserId,
model::{
id::{
GuildId, UserId,
},
channel::Message,
},
framework::Framework,
prelude::TypeMapKey,
@ -164,3 +168,8 @@ pub async fn check_subscription(cache_http: impl CacheHttp, user_id: impl Into<U
true
}
}
pub async fn check_subscription_on_message(cache_http: impl CacheHttp + AsRef<Cache>, msg: &Message) -> bool {
check_subscription(&cache_http, &msg.author).await ||
if let Some(guild) = msg.guild(&cache_http).await { check_subscription(&cache_http, guild.owner_id).await } else { false }
}