ts3plugin

Crates.iots3plugin
lib.rsts3plugin
version0.3.0
sourcesrc
created_at2016-09-07 20:46:34.314573
updated_at2024-10-03 14:45:23.665547
descriptionAn abstraction layer that simplifies creating TeamSpeak3 plugins and stores received data to provide a more convenient API.
homepage
repositoryhttps://github.com/ReSpeak/rust-ts3plugin
max_upload_size
id6278
size168,578
Sebastian Neubauer (Flakebi)

documentation

README

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.

Commit count: 91

cargo fmt