feat(config/emoji): adding the emoji configuration

This commit is contained in:
Raphael 2026-02-15 23:43:13 +01:00
parent da29493980
commit b2f19a2edb
No known key found for this signature in database

40
src/config/emoji.rs Normal file
View file

@ -0,0 +1,40 @@
use serde::Deserialize;
use std::fs;
#[derive(Debug, Deserialize, Clone)]
pub struct EmojiConfig {
pub answer: Answer,
pub badge: Badge,
pub config: Config,
}
#[derive(Debug, Deserialize, Clone)]
pub struct Answer {
pub loading: String,
pub error: String,
pub yes: String,
pub no: String,
}
#[derive(Debug, Deserialize, Clone)]
pub struct Badge {
pub dev: String,
pub enium: String,
pub buyer: String,
pub owner: String,
pub pwn: String,
}
#[derive(Debug, Deserialize, Clone)]
pub struct Config {
pub enable: String,
pub disable: String,
}
impl EmojiConfig {
pub fn load() -> Result<Self, Box<dyn std::error::Error>> {
let content: String = fs::read_to_string("emojis.toml")?;
let config: EmojiConfig = toml::from_str(&content)?;
Ok(config)
}
}