mod core;
#[doc(inline)]
pub use core::*;
mod bot;
#[doc(inline)]
pub use bot::*;
mod friend;
#[doc(inline)]
pub use friend::*;
mod group;
#[doc(inline)]
pub use group::*;
use serde::{Deserialize, Deserializer};
use serde_repr::{Deserialize_repr, Serialize_repr};
use std::path::{Path, PathBuf};
pub(crate) const fn default_cd() -> u64 {
0
}
fn empty_vec_as_none<'de, D, T>(deserializer: D) -> Result<Option<Vec<T>>, D::Error>
where
D: Deserializer<'de>,
T: Deserialize<'de>,
{
Ok(Option::<Vec<T>>::deserialize(deserializer)?.filter(|value| !value.is_empty()))
}
#[derive(Debug, Default, Clone, Copy, Serialize_repr, Deserialize_repr)]
#[repr(u8)]
pub enum ReactiveMode {
#[default]
All = 0,
AtBot = 1,
Alias = 2,
AtOrAlias = 3,
Master = 4,
}
#[derive(Debug, Clone, PartialEq)]
pub enum ConfigId {
Index(u64),
Path(PathBuf),
}
impl From<u64> for ConfigId {
fn from(index: u64) -> Self {
Self::Index(index)
}
}
impl From<PathBuf> for ConfigId {
fn from(path: PathBuf) -> Self {
Self::Path(path)
}
}
impl From<&Path> for ConfigId {
fn from(path: &Path) -> Self {
Self::Path(path.to_path_buf())
}
}
impl From<&str> for ConfigId {
fn from(path: &str) -> Self {
Self::Path(PathBuf::from(path))
}
}