diff options
| author | Jokler <jokler.contact@gmail.com> | 2017-12-24 15:27:14 +0100 |
|---|---|---|
| committer | Jokler <jokler.contact@gmail.com> | 2017-12-24 15:27:14 +0100 |
| commit | 32e870aeefee587d6eabdfa08cf27b3cf9a46f15 (patch) | |
| tree | 4313a3abec20b2038be6f1f416fc6d3352fb3c8d /src/lib.rs | |
| parent | 92ea5a1c2e0b7ddaa102d6b602d180e84964c3be (diff) | |
| download | frippy-32e870aeefee587d6eabdfa08cf27b3cf9a46f15.tar.gz frippy-32e870aeefee587d6eabdfa08cf27b3cf9a46f15.zip | |
Exit if no bot connected successfully
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -132,7 +132,7 @@ impl Bot { /// reactor.run(future::empty::<(), ()>()).unwrap(); /// # } /// ``` - pub fn connect(&self, reactor: &mut Core, config: &Config) { + pub fn connect(&self, reactor: &mut Core, config: &Config) -> Option<()> { info!("Plugins loaded: {}", self.plugins); let server = @@ -140,7 +140,7 @@ impl Bot { Ok(v) => v, Err(e) => { error!("Failed to connect: {}", e); - return; + return None; } }; @@ -148,7 +148,10 @@ impl Bot { match server.identify() { Ok(_) => info!("Identified"), - Err(e) => error!("Failed to identify: {}", e), + Err(e) => { + error!("Failed to identify: {}", e); + return None; + } }; // TODO Verify if we actually need to clone plugins twice @@ -160,6 +163,7 @@ impl Bot { .map_err(|e| error!("Failed to process message: {}", e)); reactor.handle().spawn(task); + Some(()) } } |
