changed permission chekc to be more manual since built in one isnt working
This commit is contained in:
28
src/main.rs
28
src/main.rs
@ -45,8 +45,7 @@ use std::{
|
||||
use crate::{
|
||||
framework::RegexFramework,
|
||||
consts::{
|
||||
PREFIX, DAY, HOUR, MINUTE,
|
||||
SUBSCRIPTION_ROLES, CNC_GUILD,
|
||||
PREFIX, SUBSCRIPTION_ROLES, CNC_GUILD,
|
||||
},
|
||||
commands::{
|
||||
info_cmds,
|
||||
@ -56,7 +55,6 @@ use crate::{
|
||||
},
|
||||
};
|
||||
|
||||
use num_integer::Integer;
|
||||
use serenity::futures::TryFutureExt;
|
||||
|
||||
struct SQLPool;
|
||||
@ -154,7 +152,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||
|
||||
|
||||
pub async fn check_subscription(cache_http: impl CacheHttp, user_id: impl Into<UserId>) -> bool {
|
||||
|
||||
if let Some(subscription_guild) = *CNC_GUILD {
|
||||
let guild_member = GuildId(subscription_guild).member(cache_http, user_id).await;
|
||||
|
||||
@ -177,26 +174,3 @@ pub async fn check_subscription_on_message(cache_http: impl CacheHttp + AsRef<Ca
|
||||
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 }
|
||||
}
|
||||
|
||||
pub fn shorthand_displacement(seconds: u64) -> String {
|
||||
let (hours, seconds) = seconds.div_rem(&HOUR);
|
||||
let (minutes, seconds) = seconds.div_rem(&MINUTE);
|
||||
|
||||
format!("{:02}:{:02}:{:02}", hours, minutes, seconds)
|
||||
}
|
||||
|
||||
pub fn longhand_displacement(seconds: u64) -> String {
|
||||
let (days, seconds) = seconds.div_rem(&DAY);
|
||||
let (hours, seconds) = seconds.div_rem(&HOUR);
|
||||
let (minutes, seconds) = seconds.div_rem(&MINUTE);
|
||||
|
||||
let mut sections = vec![];
|
||||
|
||||
for (var, name) in [days, hours, minutes, seconds].iter().zip(["days", "hours", "minutes", "seconds"].iter()) {
|
||||
if *var > 0 {
|
||||
sections.push(format!("{} {}", var, name));
|
||||
}
|
||||
}
|
||||
|
||||
sections.join(", ")
|
||||
}
|
||||
|
Reference in New Issue
Block a user