pub struct MattermostBot { /* private fields */ }Implementations§
Source§impl MattermostBot
impl MattermostBot
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Create a MattermostBot using env variables for url and token.
§Errors
Returns Error::EnvVarMissing if the MATTERMOST_URL or MATTERMOST_TOKEN environment variable is
missing.
Returns Error::MattermostApi if the value of MATTERMOST_URL cannot be parsed into a
url::Url
pub fn add_command<H, Args>(self, name: &str, handler: H) -> Selfwhere
H: IntoCommand<Args>,
pub fn add_admin_command<H, Args>(self, name: &str, handler: H) -> Selfwhere
H: IntoCommand<Args>,
pub fn add_admin(self, name: String) -> Self
pub fn add_admins(self, names: Vec<String>) -> Self
Sourcepub async fn listen(self) -> Result<()>
pub async fn listen(self) -> Result<()>
Connect to the websocket API on the instance and listen for incoming events.
This method loops, sending messages received from the websocket connection to the passed handler.
§Errors
Returns Error::MattermostApi if there’s a problem with setting up the websocket
connection.
Trait Implementations§
Source§impl Debug for MattermostBot
impl Debug for MattermostBot
Auto Trait Implementations§
impl !RefUnwindSafe for MattermostBot
impl !UnwindSafe for MattermostBot
impl Freeze for MattermostBot
impl Send for MattermostBot
impl Sync for MattermostBot
impl Unpin for MattermostBot
impl UnsafeUnpin for MattermostBot
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more