3 releases (breaking)
Uses old Rust 2015
0.3.0 | Oct 3, 2024 |
---|---|
0.2.1 | Jan 5, 2017 |
0.2.0 |
|
0.1.0 | Sep 7, 2016 |
#344 in Web programming
180 downloads per month
160KB
4K
SLoC
TeamSpeak3 Plugin API
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.
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.
Dependencies
~1.1–3MB
~43K SLoC