summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorseth <[email protected]>2023-11-30 22:44:26 -0500
committerseth <[email protected]>2023-12-01 07:12:49 -0500
commit41dfa94258215769b9d844875e79097d4a498770 (patch)
tree5fb5a42545477ea1958ca6e5a1c1ae9b8d4899f7 /src/main.rs
parent76c0f94e6d7aa108424b34826eb7d8514b026287 (diff)
refactor: expand Settings
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/main.rs b/src/main.rs
index 98ebe5f..0e9400b 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -19,20 +19,15 @@ type Context<'a> = poise::Context<'a, Data, Report>;
#[derive(Clone)]
pub struct Data {
- settings: Option<Settings>,
+ settings: Settings,
}
impl Data {
- pub fn new() -> Self {
- let settings = Settings::new();
+ pub fn new() -> Result<Self> {
+ let settings =
+ Settings::new().ok_or_else(|| eyre!("Couldn't create new settings object!"))?;
- Self { settings }
- }
-}
-
-impl Default for Data {
- fn default() -> Self {
- Self::new()
+ Ok(Self { settings })
}
}
@@ -82,7 +77,8 @@ async fn main() -> Result<()> {
.await?;
info!("Registered guild commands to {}", consts::TEAWIE_GUILD);
- Ok(Data::new())
+ let data = Data::new()?;
+ Ok(data)
})
});