diff options
| author | seth <[email protected]> | 2023-11-30 22:44:26 -0500 |
|---|---|---|
| committer | seth <[email protected]> | 2023-12-01 07:12:49 -0500 |
| commit | 41dfa94258215769b9d844875e79097d4a498770 (patch) | |
| tree | 5fb5a42545477ea1958ca6e5a1c1ae9b8d4899f7 /src/main.rs | |
| parent | 76c0f94e6d7aa108424b34826eb7d8514b026287 (diff) | |
refactor: expand Settings
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 18 |
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) }) }); |
