The documentation can be found here:
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.
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"
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);
Licensed under either of
at your option.
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.