Enum dazeus::Request [] [src]

pub enum Request {
    Subscribe(EventType),
    Unsubscribe(EventType),
    SubscribeCommand(CommandOption<Network>),
    Networks,
    Channels(Network),
    Message(NetworkTargetMessage),
    Notice(NetworkTargetMessage),
    Ctcp(NetworkTargetMessage),
    CtcpReply(NetworkTargetMessage),
    Action(NetworkTargetMessage),
    Names(NetworkTarget),
    Whois(NetworkTarget),
    Join(NetworkTarget),
    Part(NetworkTarget),
    Nick(Network),
    Handshake(PluginNamePluginVersionOption<String>),
    Config(StringConfigGroup),
    GetProperty(StringScope),
    SetProperty(StringStringScope),
    UnsetProperty(StringScope),
    PropertyKeys(StringScope),
    SetPermission(StringboolScope),
    HasPermission(StringboolScope),
    UnsetPermission(StringScope),
}

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 to a certain event type.

Example

Request::Subscribe(EventType::PrivMsg)

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)

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()))

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

Example

Request::Networks

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

Example

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

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())

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())

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

Example

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

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())

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())

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())

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())

Request to join a channel on some network.

Example

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

Request to leave a channel on some network.

Example

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

Request the nickname of the bot on a network.

Example

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

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)

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)

Retrieve a property from the internal DaZeus core database.

Example

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

Set a property in the internal DaZeus core database.

Example

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

Remove a property from the internal DaZeus core database.

Example

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

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"))

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

Example

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

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"))

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

Example

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

Trait Implementations

impl Debug for Request
[src]

Formats the value using the given formatter.

impl Clone for Request
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl PartialEq for Request
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl ToJson for Request
[src]

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

Converts the value of self to an instance of JSON