Trait dazeus::DaZeusClient [] [src]

pub trait DaZeusClient<'a> {
    fn try_send(&self, request: Request) -> Result<Response, Error>;
    fn send(&self, request: Request) -> Response;
    fn unsubscribe(&mut self, handle: ListenerHandle) -> Response;
    fn unsubscribe_all(&mut self, event: EventType) -> Response;
    fn has_any_subscription(&self, event: EventType) -> bool;
    fn networks(&self) -> Response;
    fn channels(&self, network: &str) -> Response;
    fn message(&self, network: &str, channel: &str, message: &str) -> Response;
    fn notice(&self, network: &str, channel: &str, message: &str) -> Response;
    fn ctcp(&self, network: &str, channel: &str, message: &str) -> Response;
    fn ctcp_reply(&self, network: &str, channel: &str, message: &str) -> Response;
    fn action(&self, network: &str, channel: &str, message: &str) -> Response;
    fn send_names(&self, network: &str, channel: &str) -> Response;
    fn send_whois(&self, network: &str, nick: &str) -> Response;
    fn join(&self, network: &str, channel: &str) -> Response;
    fn part(&self, network: &str, channel: &str) -> Response;
    fn nick(&self, network: &str) -> Response;
    fn handshake(&self, name: &str, version: &str, config: Option<&str>) -> Response;
    fn get_config(&self, name: &str, group: ConfigGroup) -> Response;
    fn get_highlight_char(&self) -> Response;
    fn get_property(&self, name: &str, scope: Scope) -> Response;
    fn set_property(&self, name: &str, value: &str, scope: Scope) -> Response;
    fn unset_property(&self, name: &str, scope: Scope) -> Response;
    fn get_property_keys(&self, prefix: &str, scope: Scope) -> Response;
    fn set_permission(&self, permission: &str, allow: bool, scope: Scope) -> Response;
    fn has_permission(&self, permission: &str, default: bool, scope: Scope) -> Response;
    fn unset_permission(&self, permission: &str, scope: Scope) -> Response;
    fn whois(&mut self, network: &str, nick: &str) -> Event;
    fn names(&mut self, network: &str, channel: &str) -> Event;
    fn reply(&self, event: &Event, message: &str, highlight: bool) -> Response;
    fn reply_with_notice(&self, event: &Event, message: &str) -> Response;
    fn reply_with_action(&self, event: &Event, message: &str) -> Response;
}

Methods for interaction with the DaZeus server.

Required Methods

fn try_send(&self, request: Request) -> Result<Response, Error>

Try to send a request to DaZeus

fn send(&self, request: Request) -> Response

Send a request to DaZeus and retrieve a Future in which the response will be contained.

fn unsubscribe(&mut self, handle: ListenerHandle) -> Response

Unsubscribe a listener for some event.

fn unsubscribe_all(&mut self, event: EventType) -> Response

Remove all subscriptions for a specific event type.

fn has_any_subscription(&self, event: EventType) -> bool

Check if there is any active listener for the given event type.

fn networks(&self) -> Response

Retrieve the networks the bot is connected to.

fn channels(&self, network: &str) -> Response

Retrieve the channels the bot is in for a given network.

fn message(&self, network: &str, channel: &str, message: &str) -> Response

Send a message to a specific channel using the PRIVMSG method.

fn notice(&self, network: &str, channel: &str, message: &str) -> Response

Send a CTCP NOTICE to a specific channel.

fn ctcp(&self, network: &str, channel: &str, message: &str) -> Response

Send a CTCP REQUEST to a specific channel.

fn ctcp_reply(&self, network: &str, channel: &str, message: &str) -> Response

Send a CTCP REPLY to a specific channel.

fn action(&self, network: &str, channel: &str, message: &str) -> Response

Send a CTCP ACTION to a specific channel

fn send_names(&self, network: &str, channel: &str) -> Response

Send a request for the list of nicks in a channel.

Note that the response will not contain the names data, instead listen for a names event. The Response will only indicate whether or not the request has been submitted successfully. The server may respond with an EventType::Names event any time after this request has been submitted.

fn send_whois(&self, network: &str, nick: &str) -> Response

Send a request for a whois of a specific nick on some network.

Note that the response will not contain the whois data, instead listen for a whois event. The Response will only indicate whether or not the request has been submitted successfully. The server may respond with an EventType::Whois event any time after this request has been submitted.

fn join(&self, network: &str, channel: &str) -> Response

Try to join a channel on some network.

fn part(&self, network: &str, channel: &str) -> Response

Try to leave a channel on some network.

fn nick(&self, network: &str) -> Response

Retrieve the nickname of the bot on the given network.

fn handshake(&self, name: &str, version: &str, config: Option<&str>) -> Response

Send a handshake to the DaZeus core.

fn get_config(&self, name: &str, group: ConfigGroup) -> Response

Retrieve a config value from the DaZeus config.

fn get_highlight_char(&self) -> Response

Retrieve the character that is used by the bot for highlighting.

fn get_property(&self, name: &str, scope: Scope) -> Response

Retrieve a property stored in the bot database.

fn set_property(&self, name: &str, value: &str, scope: Scope) -> Response

Set a property to be stored in the bot database.

fn unset_property(&self, name: &str, scope: Scope) -> Response

Remove a property stored in the bot database.

fn get_property_keys(&self, prefix: &str, scope: Scope) -> Response

Retrieve a list of keys starting with the common prefix with the given scope.

fn set_permission(&self, permission: &str, allow: bool, scope: Scope) -> Response

Set a permission to either allow or deny for a specific scope.

fn has_permission(&self, permission: &str, default: bool, scope: Scope) -> Response

Retrieve whether for some scope the given permission was set.

Will return the default if it was not.

fn unset_permission(&self, permission: &str, scope: Scope) -> Response

Remove a set permission from the bot.

fn whois(&mut self, network: &str, nick: &str) -> Event

Send a whois request and wait for an event that answers this request (blocking).

Note that the IRC server may not respond to the whois request (if it has been configured this way), in which case this request will block forever.

fn names(&mut self, network: &str, channel: &str) -> Event

Send a names request and wait for an event that answers this request (blocking).

Note that the IRC server may not respond to the names request (if it has been configured this way), in which case this request will block forever.

fn reply(&self, event: &Event, message: &str, highlight: bool) -> Response

Send a reply in response to some event.

Note that not all types of events can be responded to. Mostly message type events concerning some IRC user can be responded to. Join events can also be responded to.

fn reply_with_notice(&self, event: &Event, message: &str) -> Response

Send a reply (as a notice) in response to some event.

Note that not all types of events can be responded to. Mostly message type events concerning some IRC user can be responded to. Join events can also be responded to.

fn reply_with_action(&self, event: &Event, message: &str) -> Response

Send a reply (as a ctcp action) in response to some event.

Note that not all types of events can be responded to. Mostly message type events concerning some IRC user can be responded to. Join events can also be responded to.

Implementors