From 909e2cbdf8cbb311f4abef2c0c1d176987580a76 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Wed, 4 Aug 2021 17:22:21 +0200 Subject: feat: get faculties for the /room command --- src/browser/mod.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/browser/mod.rs') diff --git a/src/browser/mod.rs b/src/browser/mod.rs index 8359c51..2765c6d 100644 --- a/src/browser/mod.rs +++ b/src/browser/mod.rs @@ -1,3 +1,5 @@ +use std::collections::HashMap; + use self::web_browser::{Browser, WEB_BROWSER}; use crate::Config; use thirtyfour::prelude::WebDriverResult; @@ -17,3 +19,18 @@ pub async unsafe fn login(credentials: &Config) -> WebDriverResult<()> { Ok(()) } + +pub async unsafe fn get_faculties() -> WebDriverResult>> { + if let Some(driver) = &WEB_BROWSER { + match driver.faculties().await? { + Some(faculties) => { + return Ok(Some(faculties)); + } + None => { + return Ok(Some(HashMap::::new())); + } + }; + } + + Ok(Some(HashMap::::new())) +} -- cgit v1.2.3-18-g5258