项目作者: Multivit4min

项目描述 :
create custom commands with ts3-nodejs-library
高级语言: TypeScript
项目地址: git://github.com/Multivit4min/teamspeak-commander.git
创建时间: 2019-07-25T02:27:12Z
项目社区:https://github.com/Multivit4min/teamspeak-commander

开源协议:

下载


TeamSpeak Command Interface for TS3-NodeJS-Library

Build Status
Coverage Status
npm
Discord

This is still work in progress API may change without notice

Introduction

This library allows you to easily create commands for your teamspeak server using ts3-nodejs-library

Install

npm install --save teamspeak-commander

Documentation

You can find all necessary documentation here or a lot of examples in the docs folder of this project!

Usage:

  1. const { TeamSpeak } = require("ts3-nodejs-library")
  2. const { Commander } = require("teamspeak-commander")
  3. const commander = new Commander({ prefix: "!" })
  4. //command !ping
  5. commander.createCommand("ping")
  6. .setHelp("sends pong as response")
  7. .run(event => {
  8. event.reply("Pong!")
  9. })
  10. //command !roll 10 -> rolls a number between 1 and 10
  11. //command !roll -> rolls a number between 1 and 6
  12. commander.createCommand("roll")
  13. .help("rolls a number")
  14. .addArgument(arg => arg.number.name("max").optional(6))
  15. .run(event => {
  16. const random = Math.floor(Math.random() * event.arguments.max) + 1
  17. event.reply(`Rolled a ${random} (from 1-${event.arguments.max})`)
  18. })
  19. TeamSpeak.connect({
  20. host: "....",
  21. }).then(teamspeak => {
  22. commander.addInstance(teamspeak)
  23. })