aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authorJokler <jokler.contact@gmail.com>2018-03-19 17:10:11 +0100
committerJokler <jokler.contact@gmail.com>2018-03-19 17:10:11 +0100
commit00951e31da6b74c422d26eaa572df39c365ebf9b (patch)
treeda0106196b394f5a373caefbbd1df7576d7b392e /src/lib.rs
parent997707cfa933bec05faa281236911d893a8a9ba1 (diff)
downloadfrippy-00951e31da6b74c422d26eaa572df39c365ebf9b.tar.gz
frippy-00951e31da6b74c422d26eaa572df39c365ebf9b.zip
Fix doctests
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 8477fd2..165651b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -14,7 +14,7 @@
//!
//! let config = Config::load("config.toml").unwrap();
//! let mut reactor = IrcReactor::new().unwrap();
-//! let mut bot = Bot::new();
+//! let mut bot = Bot::new(".");
//!
//! bot.add_plugin(plugins::help::Help::new());
//! bot.add_plugin(plugins::emoji::Emoji::new());
@@ -79,16 +79,18 @@ pub struct Bot<'a> {
}
impl<'a> Bot<'a> {
- /// Creates a `Bot`.
+ /// Creates a `Bot` without any plugins.
/// By itself the bot only responds to a few simple CTCP commands
/// defined per config file.
/// Any other functionality has to be provided by plugins
- /// which need to implement [`Plugin`](plugin/trait.Plugin.html).
+ /// which need to implement [`Plugin`](plugin/trait.Plugin.html).
+ /// To send commands to a plugin
+ /// the message has to start with the plugin's name prefixed by `cmd_prefix`.
///
/// # Examples
/// ```
/// use frippy::Bot;
- /// let mut bot = Bot::new();
+ /// let mut bot = Bot::new(".");
/// ```
pub fn new(cmd_prefix: &'a str) -> Bot<'a> {
Bot {
@@ -104,7 +106,7 @@ impl<'a> Bot<'a> {
/// ```
/// use frippy::{plugins, Bot};
///
- /// let mut bot = frippy::Bot::new();
+ /// let mut bot = frippy::Bot::new(".");
/// bot.add_plugin(plugins::help::Help::new());
/// ```
pub fn add_plugin<T: Plugin + 'static>(&mut self, plugin: T) {
@@ -119,7 +121,7 @@ impl<'a> Bot<'a> {
/// ```
/// use frippy::{plugins, Bot};
///
- /// let mut bot = frippy::Bot::new();
+ /// let mut bot = frippy::Bot::new(".");
/// bot.add_plugin(plugins::help::Help::new());
/// bot.remove_plugin("Help");
/// ```
@@ -146,7 +148,7 @@ impl<'a> Bot<'a> {
///
/// let config = Config::load("config.toml").unwrap();
/// let mut reactor = IrcReactor::new().unwrap();
- /// let mut bot = Bot::new();
+ /// let mut bot = Bot::new(".");
///
/// bot.connect(&mut reactor, &config).unwrap();
/// reactor.run().unwrap();