Skip to content

Latest commit

 

History

History
86 lines (62 loc) · 2.26 KB

README.md

File metadata and controls

86 lines (62 loc) · 2.26 KB

TeamSpeak3 Plugin API   Latest version

The documentation can be found here: At docs.rs

TeamSpeak 3.6 updates the plugin api version to 26. Version 0.3 is compatible with this version.

At the moment, not all methods that are exposed by the TeamSpeak API are available for plugins. If a method that you need is missing, please file an issue or open a pull request.

Usage

Add the following to your Cargo.toml:

[package]
name = "<pluginname>"
version = "<version>"
authors = ["<your name>"]
description = "<description>"

[lib]
name = "<pluginname>"
crate-type = ["cdylib"]

[dependencies]
ts3plugin = "0.3"

Example

A fully working example, which creates a plugin that does nothing:

#[macro_use]
extern crate ts3plugin;

use ts3plugin::*;

struct MyTsPlugin;

impl Plugin for MyTsPlugin {
    // The default name is the crate name, but we can overwrite it here.
    fn name()        -> String { String::from("My Ts Plugin") }
    fn command() -> Option<String> { Some(String::from("myplugin")) }
    fn autoload() -> bool { false }
    fn configurable() -> ConfigureOffer { ConfigureOffer::No }

    // The only required method
    fn new(api: &TsApi) -> Result<Box<MyTsPlugin>, InitError> {
        api.log_or_print("Inited", "MyTsPlugin", LogLevel::Info);
        Ok(Box::new(MyTsPlugin))
        // Or return Err(InitError::Failure) on failure
    }

    // Implement callbacks here

    fn shutdown(&mut self, api: &TsApi) {
        api.log_or_print("Shutdown", "MyTsPlugin", LogLevel::Info);
    }
}

create_plugin!(MyTsPlugin);

Projects using this library

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.