Enum dazeus::Request [] [src]

pub enum Request {
    Subscribe(EventType),
    Unsubscribe(EventType),
    SubscribeCommand(Command, Option<Network>),
    Networks,
    Channels(Network),
    Message(Network, Target, Message),
    Notice(Network, Target, Message),
    Ctcp(Network, Target, Message),
    CtcpReply(Network, Target, Message),
    Action(Network, Target, Message),
    Names(Network, Target),
    Whois(Network, Target),
    Join(Network, Target),
    Part(Network, Target),
    Nick(Network),
    Handshake(PluginName, PluginVersion, Option<String>),
    Config(String, ConfigGroup),
    GetProperty(String, Scope),
    SetProperty(String, String, Scope),
    UnsetProperty(String, Scope),
    PropertyKeys(String, Scope),
    SetPermission(String, bool, Scope),
    HasPermission(String, bool, Scope),
    UnsetPermission(String, Scope),
}

An enum of all requests that can be sent to your DaZeus instance.

Note that typically you won't create these request instances directly. Instead you can use the different DaZeus methods. However if you wish, you can directly use DaZeus::send() to send these requests yourself.

Variants

Subscribe

Subscribe to a certain event type.

Example

Request::Subscribe(EventType::PrivMsg)
Unsubscribe

Unsubscribe from an event.

Note that you cannot specify EventType::Command() for this request, as registered commands cannot be unregistered from the DaZeus server. To stop listening, just let DaZeus remove the listener.

Example

Request::Unsubscribe(EventType::Join)
SubscribeCommand

Subscribe to a command (optionally on a specific network).

You can use Request::Subscribe(EventType::Command("example".to_string()) as an alternative to Request::SubscribeCommand("example".to_string()). Note that the former does not allow you to optionally specify a network on which the command is actively listened to.

Example

Request::SubscribeCommand("greet".to_string(), Some("freenode".to_string()))
Networks

Retrieve a list of networks that the DaZeus core is currently connected to.

Example

Request::Networks
Channels

Retrieve a list of channels on the specified network that the bot has joined.

Example

Request::Channels("freenode".to_string())
Message

Request to send a message to a specific target on some network.

This will request DaZeus to send a PRIVMSG.

Example

Request::Message("freenode".to_string(), "#botters-test".to_string(), "Hello!".to_string())
Notice

Request to send a notice to some target on some network.

This will request DaZeus to send a NOTICE.

Example

Request::Notice("example".to_string(), "MrExample".to_string(), "Message!".to_string())
Ctcp

Request to send a CTCP message to some client on some network.

Example

Request::Ctcp("example".to_string(), "MrExample".to_string(), "VERSION".to_string())
CtcpReply

Request to send a CTCP message reply to some client on some network.

Example

Request::CtcpReply("example".to_string(), "MrExample".to_string(), "VERSION DaZeus 2.0".to_string())
Action

Request to send a CTCP ACTION message to some target on some network.

A CTCP ACTION is most known by users as the /me command.

Example

Request::Action("example".to_string(), "#example", "is creating an example".to_string())
Names

Request to send the list of names in some channel.

Note that such a request will generate an EventType::Names event if the server allows it, instead of responding to this request directly.

Example

Request::Names("freenode".to_string(), "#freenode".to_string())
Whois

Request to send a whois on some target.

Note that such a request will generate an EventType::Whois event if the server allows it, instead of responding to this request directly.

Example

Request::Whois("example".to_string(), "MrExample".to_string())
Join

Request to join a channel on some network.

Example

Request::Join("freenode".to_string(), "#freenode".to_string())
Part

Request to leave a channel on some network.

Example

Request::Part("freenode".to_string(), "#freenode".to_string())
Nick

Request the nickname of the bot on a network.

Example

Request::Nick("freenode".to_string())
Handshake

Request for a handshake to the DaZeus Core.

The handshake allows the plugin to retrieve configuration options.

The second parameter of this request variant is the plugin version. Note that this parameter should be equal to the version that these bindings understand.

The optional third parameter may provide an alternative name to be used to retrieve options from the DaZeus core config. By default the name of the plugin will be used.

Example

Request::Handshake("my_plugin".to_string(), PROTOCOL_VERSION.to_string(), None)
Config

Retrieve some option from the DaZeus core config.

The second parameter is the section from which the configuration parameter should be retrieved. This may either be ConfigGroup::Core or ConfigGroup::Plugin

Note that in order to successfully retrieve these configuration values the plugin first needs to have completed a succesful handshake with the core.

Example

Request::Config("highlight".to_string(), ConfigGroup::Core)
GetProperty

Retrieve a property from the internal DaZeus core database.

Example

Request::GetProperty("example".to_string(), Scope::any())
SetProperty

Set a property in the internal DaZeus core database.

Example

Request::SetProperty("example".to_string(), "value".to_string(), Scope::any())
UnsetProperty

Remove a property from the internal DaZeus core database.

Example

Request::UnsetProperty("example".to_string(), Scope::any())
PropertyKeys

Retrieve a set of keys that is available for some prefix and scope.

The first parameter of the variant is the prefix string for retrieving property keys.

Example

Request::PropertyKeys("path.to".to_string(), Scope::network("example"))
SetPermission

Set a permission in the permission database of the DaZeus core.

Example

Request::SetPermission("edit".to_string(), true, Scope::sender("example", "MrExample"))
HasPermission

Request a permission to be retrieved from the permission database of the DaZeus core.

The second parameter of this variant indicates the default value that the core should return if the permission was not found inside the permission database.

Example

Request::HasPermission("edit".to_string(), false, Scope::sender("example", "MrExample"))
UnsetPermission

Remove a permission from the permission database of the DaZeus core.

Example

Request::UnsetPermission("edit".to_string(), Scope::sender("example", "MrExample"))

Trait Implementations

impl ToJson for Request

Implements transforming the request to a Json object that is ready to be sent a DaZeus core.

fn to_json(&self) -> Json

Derived Implementations

impl PartialEq for Request

fn eq(&self, __arg_0: &Request) -> bool

fn ne(&self, __arg_0: &Request) -> bool

impl Clone for Request

fn clone(&self) -> Request

fn clone_from(&mut self, source: &Self)

impl Debug for Request

fn fmt(&self, __arg_0: &mut Formatter) -> Result