Added method to get config from bots.
This commit is contained in:
parent
54e781e6e7
commit
bf31646bdd
2 changed files with 6 additions and 1 deletions
|
@ -23,7 +23,7 @@ impl<'a> Message<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(Decodable)]
|
||||
#[deriving(Clone, Decodable)]
|
||||
pub struct Config {
|
||||
pub owners: Vec<String>,
|
||||
pub nickname: String,
|
||||
|
|
|
@ -23,6 +23,7 @@ pub trait Bot<'a> {
|
|||
fn send_privmsg(&self, chan: &str, msg: &str) -> IoResult<()>;
|
||||
fn identify(&self) -> IoResult<()>;
|
||||
fn output(&mut self) -> IoResult<()>;
|
||||
fn config(&self) -> Config;
|
||||
}
|
||||
|
||||
pub struct IrcBot<'a, T, U> where T: IrcWriter, U: IrcReader {
|
||||
|
@ -161,6 +162,10 @@ impl<'a, T, U> Bot<'a> for IrcBot<'a, T, U> where T: IrcWriter, U: IrcReader {
|
|||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn config(&self) -> Config {
|
||||
self.config.clone()
|
||||
}
|
||||
}
|
||||
|
||||
fn process(msg: &str) -> IoResult<(&str, &str, Vec<&str>)> {
|
||||
|
|
Loading…
Reference in a new issue