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(EventType)
Unsubscribe(EventType)
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(Command, Option<Network>)
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(Network)
Retrieve a list of channels on the specified network that the bot has joined.
Example
Request::Channels("freenode".to_string())
Message(Network, Target, 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(Network, Target, Message)
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(Network, Target, Message)
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(Network, Target, Message)
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(Network, Target, Message)
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(Network, Target)
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(Network, Target)
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(Network, Target)
Request to join a channel on some network.
Example
Request::Join("freenode".to_string(), "#freenode".to_string())
Part(Network, Target)
Request to leave a channel on some network.
Example
Request::Part("freenode".to_string(), "#freenode".to_string())
Nick(Network)
Handshake(PluginName, PluginVersion, Option<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)
Config(String, ConfigGroup)
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(String, Scope)
Retrieve a property from the internal DaZeus core database.
Example
Request::GetProperty("example".to_string(), Scope::any())
SetProperty(String, String, Scope)
Set a property in the internal DaZeus core database.
Example
Request::SetProperty("example".to_string(), "value".to_string(), Scope::any())
UnsetProperty(String, Scope)
Remove a property from the internal DaZeus core database.
Example
Request::UnsetProperty("example".to_string(), Scope::any())
PropertyKeys(String, Scope)
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(String, bool, Scope)
Set a permission in the permission database of the DaZeus core.
Example
Request::SetPermission("edit".to_string(), true, Scope::sender("example", "MrExample"))
HasPermission(String, bool, Scope)
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(String, Scope)
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]
impl Clone for Request
[src]
fn clone(&self) -> Request
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl PartialEq for Request
[src]
fn eq(&self, __arg_0: &Request) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Request) -> bool
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.