pub struct Bot { /* private fields */ }
Expand description
Main bot class
Implementations§
source§impl Bot
impl Bot
sourcepub fn builder(api_url: String, rest_url: String) -> Builder
pub fn builder(api_url: String, rest_url: String) -> Builder
Build a Bot
instance programmatically.
sourcepub async fn from_default_config() -> Result<Self, ConfigError>
pub async fn from_default_config() -> Result<Self, ConfigError>
Load Bot configuration from a default location, first look at
mwbot.toml
in the current directory, otherwise look in the
platform’s config directory:
- Linux:
$XDG_CONFIG_HOME
or$HOME/.config
- macOS:
$HOME/Library/Application Support
- Windows:
{FOLDERID_RoamingAppData}
sourcepub async fn from_path(path: &Path) -> Result<Self, ConfigError>
pub async fn from_path(path: &Path) -> Result<Self, ConfigError>
Load Bot configuration from the specified path.
sourcepub fn api(&self) -> &ApiClient
pub fn api(&self) -> &ApiClient
Get a reference to the underlying mwapi::Client
to make arbitrary API requests
sourcepub fn parsoid(&self) -> &ParsoidClient
pub fn parsoid(&self) -> &ParsoidClient
Get a reference to the underlying parsoid::Client
to make arbitrary Parsoid API requests
sourcepub fn page(&self, title: &str) -> Result<Page>
pub fn page(&self, title: &str) -> Result<Page>
Get a Page
on this wiki. The specified title should be a full title,
including namespace. This does some validation on the
provided input.
sourcepub fn page_from_database(&self, namespace: i32, dbkey: &str) -> Result<Page>
pub fn page_from_database(&self, namespace: i32, dbkey: &str) -> Result<Page>
Get a Page
on this wiki using information from a database row.
The provided input will be validated and may return an error if invalid.
sourcepub async fn page_from_id(&self, page_id: u64) -> Result<Page>
pub async fn page_from_id(&self, page_id: u64) -> Result<Page>
Get a Page
on this wiki using page id.
The provided input will be validated and may return an error if invalid.