mirror of
https://github.com/revanced/revanced-discord-bot.git
synced 2025-05-01 06:54:27 +02:00
refactor: move parse_duration
to mod.rs
This commit is contained in:
parent
8cc873dcd5
commit
b349d63b93
@ -1,6 +1,6 @@
|
|||||||
use bson::{doc, Document};
|
use bson::{doc, Document};
|
||||||
use chrono::{Duration, Utc};
|
use chrono::{Duration, Utc};
|
||||||
use crate::utils::moderation::parse_duration;
|
use crate::utils::parse_duration;
|
||||||
use mongodb::options::{UpdateModifications, UpdateOptions};
|
use mongodb::options::{UpdateModifications, UpdateOptions};
|
||||||
use poise::serenity_prelude::{
|
use poise::serenity_prelude::{
|
||||||
self as serenity, Mentionable, PermissionOverwrite, Permissions, UserId,
|
self as serenity, Mentionable, PermissionOverwrite, Permissions, UserId,
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
use chrono::Duration;
|
||||||
use poise::serenity_prelude::{self as serenity, Member, RoleId};
|
use poise::serenity_prelude::{self as serenity, Member, RoleId};
|
||||||
|
|
||||||
pub mod autorespond;
|
pub mod autorespond;
|
||||||
@ -9,3 +10,8 @@ pub mod macros;
|
|||||||
pub mod media_channel;
|
pub mod media_channel;
|
||||||
pub mod moderation;
|
pub mod moderation;
|
||||||
pub mod poll;
|
pub mod poll;
|
||||||
|
|
||||||
|
pub fn parse_duration(duration: String) -> Result<Duration, go_parse_duration::Error> {
|
||||||
|
let d = go_parse_duration::parse_duration(&duration)?;
|
||||||
|
Ok(Duration::nanoseconds(d))
|
||||||
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use chrono::Duration;
|
|
||||||
use mongodb::options::FindOptions;
|
use mongodb::options::FindOptions;
|
||||||
use poise::serenity_prelude::{ChannelId, GuildChannel, GuildId, Mentionable, User, UserId};
|
use poise::serenity_prelude::{ChannelId, GuildChannel, GuildId, Mentionable, User, UserId};
|
||||||
use tokio::task::JoinHandle;
|
use tokio::task::JoinHandle;
|
||||||
@ -401,7 +400,3 @@ pub async fn mute_moderation(
|
|||||||
Ok((is_currently_muted, removed_roles))
|
Ok((is_currently_muted, removed_roles))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn parse_duration(duration: String) -> Result<Duration, go_parse_duration::Error> {
|
|
||||||
let d = go_parse_duration::parse_duration(&duration)?;
|
|
||||||
Ok(Duration::nanoseconds(d))
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user