Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TeamSpeak

Hierarchy

  • EventEmitter
    • TeamSpeak

Index

Enumerations

Interfaces

Constructors

Properties

Methods

Object literals

Constructors

constructor

Properties

Private channelgroups

channelgroups: Record<string, TeamSpeakChannelGroup>

Private channels

channels: Record<string, TeamSpeakChannel>

Private clients

clients: Record<string, TeamSpeakClient>

Readonly config

Private priorizeNextCommand

priorizeNextCommand: boolean = false

Private query

Private serverVersion

serverVersion: Version | undefined

Private servergroups

servergroups: Record<string, TeamSpeakServerGroup>

Private servers

servers: Record<string, TeamSpeakServer>

Static defaultMaxListeners

defaultMaxListeners: number

Static Readonly errorMonitor

errorMonitor: keyof symbol

This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.

Installing a listener using this symbol does not change the behavior once an 'error' event is emitted, therefore the process will still crash if no regular 'error' listener is installed.

Methods

addListener

  • addListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

apiKeyAdd

  • apiKeyAdd(props: ApiKeyAdd): Promise<ApiKeyAdd>

apiKeyDel

  • apiKeyDel(id: string): Promise<[]>
  • Deletes an apikey. Any apikey owned by the current user, can always be deleted Deleting apikeys from other requires bVirtualserverApikeyManage

    Parameters

    • id: string

      the key id to delete

    Returns Promise<[]>

apiKeyList

  • apiKeyList(props?: ApiKeyList): Promise<ApiKeyEntry[]>
  • Lists all apikeys owned by the user, or of all users using cldbid=*. Usage of cldbid=... requires bVirtualserverApikeyManage.

    Parameters

    • Default value props: ApiKeyList = {}

    Returns Promise<ApiKeyEntry[]>

ban

  • ban(properties: BanAdd): Promise<BanAdd>
  • Adds a new ban rule on the selected virtual server. All parameters are optional but at least one of the following must be set: ip, name, uid or mytsid.

    Parameters

    • properties: BanAdd

    Returns Promise<BanAdd>

banClient

  • Bans the client specified with ID clid from the server. Please note that this will create two separate ban rules for the targeted clients IP address and his unique identifier.

    Parameters

    Returns Promise<BanAdd>

banDel

  • banDel(banid?: undefined | string): Promise<[]>
  • Removes one or all bans from the server

    Parameters

    • Optional banid: undefined | string

      the banid to remove, if not provided it will remove all bans

    Returns Promise<[]>

banList

  • banList(start?: undefined | number, duration?: undefined | number): Promise<BanEntry[]>
  • Displays a list of active bans on the selected virtual server.

    Parameters

    • Optional start: undefined | number

      optional start from where clients should be listed

    • Optional duration: undefined | number

      optional duration on how much ban entries should be retrieved

    Returns Promise<BanEntry[]>

bindingList

channelClientPermList

  • channelClientPermList(channel: ChannelType, client: ClientType, permsid?: undefined | false): Promise<Response.ChannelClientPermIdList>
  • channelClientPermList(channel: ChannelType, client: ClientType, permsid?: undefined | true): Promise<Response.ChannelClientPermSidList>
  • displays a list of permissions defined for a client in a specific channel

    Parameters

    • channel: ChannelType

      the channel to search from

    • client: ClientType

      the client database id to get permissions from

    • Optional permsid: undefined | false

      wether to retrieve permission names instead of ids

    Returns Promise<Response.ChannelClientPermIdList>

  • Parameters

    Returns Promise<Response.ChannelClientPermSidList>

channelCreate

  • Creates a new channel using the given properties. Note that this command accepts multiple properties which means that you're able to specifiy all settings of the new channel at once.

    Parameters

    • name: string

      the name of the channel

    • Default value properties: ChannelEdit = {}

      properties of the channel

    Returns Promise<TeamSpeakChannel>

channelDelPerm

  • channelDelPerm(channel: ChannelType, perm: string | number): Promise<[]>
  • Removes a set of specified permissions from a channel. Multiple permissions can be removed at once. A permission can be specified by permid or permsid.

    Parameters

    • channel: ChannelType

      the channel id

    • perm: string | number

      the permid or permsid

    Returns Promise<[]>

channelDelete

  • channelDelete(channel: ChannelType, force?: boolean): Promise<[]>
  • Deletes an existing channel by ID. If force is set to 1, the channel will be deleted even if there are clients within. The clients will be kicked to the default channel with an appropriate reason message.

    Parameters

    • channel: ChannelType

      the channel id

    • Default value force: boolean = false

      if set to 1 the channel will be deleted even when client are in it

    Returns Promise<[]>

channelEdit

  • Changes a channels configuration using given properties. Note that this command accepts multiple properties which means that you're able to change all settings of the channel specified with cid at once.

    Parameters

    • channel: ChannelType

      the channel id

    • Default value properties: ChannelEdit = {}

      the properties of the channel which should get changed

    Returns Promise<[]>

channelFind

  • displays a list of channels matching a given name pattern

    Parameters

    • pattern: string

      the channel name pattern to search for

    Returns Promise<ChannelFind[]>

channelGroupAddPerm

channelGroupClientList

channelGroupCopy

  • Creates a copy of the channel group. If tcgid is set to 0, the server will create a new group. To overwrite an existing group, simply set tcgid to the ID of a designated target group. If a target group is set, the name parameter will be ignored.

    Parameters

    • sourceGroup: GroupType

      the source channelgroup

    • Default value targetGroup: GroupType = "0"

      the target channelgroup (0 to create a new group)

    • Default value type: number = 1

      the type of the group (0 = Template Group | 1 = Normal Group)

    • Default value name: string = "foo"

      name of the goup

    Returns Promise<ChannelGroupCopy>

channelGroupCreate

  • Creates a new channel group using a given name. The optional type parameter can be used to create ServerQuery groups and template groups.

    Parameters

    • name: string

      the name of the channelgroup

    • Default value type: number = 1

      type of the channelgroup

    Returns Promise<TeamSpeakChannelGroup>

channelGroupDelPerm

  • channelGroupDelPerm(group: GroupType, perm: string | number): Promise<[]>
  • Removes a set of specified permissions from the channel group. A permission can be specified by permid or permsid.

    Parameters

    • group: GroupType

      the channelgroup id

    • perm: string | number

      the permid or permsid

    Returns Promise<[]>

channelGroupList

channelGroupPermList

  • channelGroupPermList(group: GroupType, permsid?: boolean): Promise<Permission<{ cgid: string }>[]>
  • Displays a list of permissions assigned to the channel group specified with cgid.

    Parameters

    • group: GroupType

      the channelgroup id to list

    • Default value permsid: boolean = false

      if the permsid option is set to true the output will contain the permission names.

    Returns Promise<Permission<{ cgid: string }>[]>

channelGroupPrivilegeKeyAdd

  • channelGroupPrivilegeKeyAdd(group: GroupType, channel: ChannelType, description?: undefined | string, customset?: undefined | string): Promise<Token>
  • Create a new privilegekey token for a Channel Group and assigned Channel ID with the given description

    Parameters

    • group: GroupType

      the channel group for which the token should be valid

    • channel: ChannelType
    • Optional description: undefined | string

      token description

    • Optional customset: undefined | string

    Returns Promise<Token>

channelGroupRename

  • channelGroupRename(group: GroupType, name: string): Promise<[]>
  • Changes the name of the channel group

    Parameters

    • group: GroupType

      the channelgroup id to rename

    • name: string

      new name of the ghannelgroup

    Returns Promise<[]>

channelInfo

channelList

channelMove

  • Moves a channel to a new parent channel with the ID cpid. If order is specified, the channel will be sorted right under the channel with the specified ID. If order is set to 0, the channel will be sorted right below the new parent.

    Parameters

    • channel: ChannelType

      the channel id

    • parent: ChannelType

      channel parent id

    • Default value order: number = 0

      channel sort order

    Returns Promise<[]>

channelPermList

  • Displays a list of permissions defined for a channel.

    Parameters

    • channel: ChannelType

      the channel id

    • Default value permsid: boolean = false

      whether the permsid should be displayed aswell

    Returns Promise<Permission<{ cid: string }>[]>

channelSetPerm

channelSetPerms

  • channelSetPerms(channel: ChannelType, permissions: { permid?: undefined | number; permsid?: undefined | string; permvalue: number }[]): Promise<[]>
  • Adds a set of specified permissions to a channel. A permission can be specified by permid or permsid.

    example

    TeamSpeak.channelSetPerms(5, [{ permsid: "i_channel_needed_modify_power", permvalue: 75 }])

    Parameters

    • channel: ChannelType

      the channel id

    • permissions: { permid?: undefined | number; permsid?: undefined | string; permvalue: number }[]

      the permissions to assign

    Returns Promise<[]>

clientAddPerm

  • Adds a set of specified permissions to a client. Multiple permissions can be added by providing the three parameters of each permission. A permission can be specified by permid or permsid.

    Parameters

    • client: ClientType

      the client database id

    • perm: undefined

      the permission object

    Returns Permission

  • Parameters

    Returns Promise<[]>

clientAddServerGroup

  • Adds one or more servergroups to a client. Please note that a client cannot be added to default groups or template groups

    Parameters

    • client: ClientType

      one or more client database ids which should be added

    • group: MultiGroupType

      one or more servergroup ids which the client should be added to

    Returns Promise<[]>

clientDbDelete

  • Deletes a clients properties from the database.

    Parameters

    • client: ClientType

      the client database id which should be deleted

    Returns Promise<[]>

clientDbEdit

  • Changes a clients settings using given properties.

    Parameters

    • client: ClientType

      the client database id which should be edited

    • properties: ClientDBEdit

      the properties which should be modified

    Returns Promise<[]>

clientDbFind

  • clientDbFind(pattern: string, isUid?: boolean): Promise<ClientDBFind[]>
  • Displays a list of client database IDs matching a given pattern. You can either search for a clients last known nickname or his unique identity by using the -uid option.

    Parameters

    • pattern: string

      the pattern which should be searched for

    • Default value isUid: boolean = false

      true when instead of the Name it should be searched for an uid

    Returns Promise<ClientDBFind[]>

clientDbInfo

clientDbList

  • clientDbList(start?: number, duration?: number, count?: boolean): Promise<ClientDBEntry[]>
  • Returns the Clients Database List

    Parameters

    • Default value start: number = 0

      start offset

    • Default value duration: number = 1000

      amount of entries which should get retrieved

    • Default value count: boolean = true

      retrieve the count of entries

    Returns Promise<ClientDBEntry[]>

clientDelPerm

  • clientDelPerm(client: ClientType, perm: string | number): Promise<[]>
  • Removes a set of specified permissions from a client. Multiple permissions can be removed at once. A permission can be specified by permid or permsid

    Parameters

    • client: ClientType

      the client database id

    • perm: string | number

      the permid or permsid

    Returns Promise<[]>

clientDelServerGroup

  • Removes one or more servergroups from the client.

    Parameters

    • client: ClientType

      one or more client database ids which should be added

    • groups: MultiGroupType

      one or more servergroup ids which the client should be removed from

    Returns Promise<[]>

clientEdit

clientFind

  • clientFind(pattern: string): Promise<ClientFind>
  • displays a list of clients matching a given name pattern

    Parameters

    • pattern: string

      the pattern to search clients

    Returns Promise<ClientFind>

clientGetDbidFromUid

clientGetIds

  • displays all client IDs matching the unique identifier specified by cluid

    Parameters

    • cluid: string

      the unique id to search for

    Returns Promise<ClientGetIdEntry[]>

clientGetNameFromDbid

  • displays the unique identifier and nickname matching the database ID specified by cldbid

    Parameters

    • cldbid: string

      client database it to search from

    Returns Promise<ClientGetNameFromDbid>

clientGetNameFromUid

  • displays the database ID and nickname matching the unique identifier specified by cluid

    Parameters

    • cluid: string

      the unique id to search for

    Returns Promise<ClientGetNameFromUid>

clientGetUidFromClid

  • displays the database ID and nickname matching the unique identifier specified by cluid

    Parameters

    • clid: string

      the client id to search from

    Returns Promise<ClientGetUidFromClid>

clientInfo

clientKick

  • Kicks the Client from the Server

    Parameters

    • client: ClientType

      the client id

    • reasonid: ReasonIdentifier

      the reasonid

    • reasonmsg: string

      the message the client should receive when getting kicked

    Returns Promise<[]>

clientList

clientMove

  • Moves the Client to a different Channel

    Parameters

    • client: ClientType

      the client id

    • channel: ChannelType

      channel id in which the client should get moved

    • Optional cpw: undefined | string

      the channel password

    Returns Promise<[]>

clientPermList

  • Displays a list of permissions defined for a client

    Parameters

    • client: ClientType

      the client database id

    • Default value permsid: boolean = false

      if the permsid option is set to true the output will contain the permission names

    Returns Promise<Permission<{ cldbid: string }>[]>

clientPoke

  • clientPoke(client: ClientType, msg: string): Promise<[]>
  • Pokes the Client with a certain message

    Parameters

    • client: ClientType

      the client id

    • msg: string

      the message the client should receive

    Returns Promise<[]>

clientSetServerQueryLogin

clientUpdate

  • Change your ServerQuery clients settings using given properties.

    Parameters

    • props: ClientUpdate

      the properties which should be changed

    Returns Promise<[]>

complainAdd

  • complainAdd(client: ClientType, message?: string): Promise<[]>
  • Submits a complaint about the client with database ID dbid to the server.

    Parameters

    • client: ClientType

      filter only for certain client with the given database id

    • Default value message: string = ""

      the Message which should be added

    Returns Promise<[]>

complainDel

  • Deletes the complaint about the client with ID tcldbid submitted by the client with ID fdbid from the server. If fcldbid will be left empty all complaints for the tcldbid will be deleted

    Parameters

    • targetClient: ClientType

      the target client database id

    • Optional fromClient: ClientType

      the client database id which filed the report

    Returns Promise<[]>

complainList

  • Displays a list of complaints on the selected virtual server. If dbid is specified, only complaints about the targeted client will be shown.

    Parameters

    • Optional client: ClientType

      filter only for certain client with the given database id

    Returns Promise<ComplainEntry[]>

connect

connectionInfo

Private createChannelGroupPermBuilder

  • createChannelGroupPermBuilder(cgid: string): Permission<{ cgid: string }>
  • creates a channel group perm builder for the specified channel group id

    Parameters

    • cgid: string

    Returns Permission<{ cgid: string }>

Private createChannelPermBuilder

  • createChannelPermBuilder(cid: string): Permission<{ cid: string }>

Private createClientPermBuilder

  • createClientPermBuilder(cldbid: string): Permission<{ cldbid: string }>
  • creates a client perm builder for the specified client database id

    Parameters

    • cldbid: string

    Returns Permission<{ cldbid: string }>

Private createServerGroupPermBuilder

  • createServerGroupPermBuilder(sgid: string): Permission<{ sgid: string }>
  • creates a servergroup perm builder for the specified server group id

    Parameters

    • sgid: string

    Returns Permission<{ sgid: string }>

createSnapshot

  • createSnapshot(password?: undefined | string): Promise<SnapshotCreate>
  • displays a snapshot of the selected virtual server containing all settings, groups and known client identities. The data from a server snapshot can be used to restore a virtual servers configuration, channels and permissions using the serversnapshotdeploy command. only supports version 2 (from server 3.10.0)

    Parameters

    • Optional password: undefined | string

      the optional password to encrypt the snapshot

    Returns Promise<SnapshotCreate>

customDelete

  • customDelete(client: ClientType, ident: string): Promise<[]>
  • Removes a custom property from a client specified by the cldbid. This requires TeamSpeak Server Version 3.2.0 or newer.

    Parameters

    • client: ClientType

      the client Database ID which should be changed

    • ident: string

      the key which should be deleted

    Returns Promise<[]>

customInfo

  • returns a list of custom properties for the client specified with cldbid.

    Parameters

    • client: ClientType

      the Client Database ID which should be retrieved

    Returns Promise<CustomInfo>

customSearch

  • customSearch(ident: string, pattern: string): Promise<CustomSearch>
  • Searches for custom client properties specified by ident and value. The value parameter can include regular characters and SQL wildcard characters (e.g. %).

    Parameters

    • ident: string

      the key to search for

    • pattern: string

      the search pattern to use

    Returns Promise<CustomSearch>

customSet

  • customSet(client: ClientType, ident: string, value: string): Promise<[]>
  • Creates or updates a custom property for client specified by the cldbid. Ident and value can be any value, and are the key value pair of the custom property. This requires TeamSpeak Server Version 3.2.0 or newer.

    Parameters

    • client: ClientType

      the client database id which should be changed

    • ident: string

      the key which should be set

    • value: string

      the value which should be set

    Returns Promise<[]>

deleteChannelGroup

  • deleteChannelGroup(group: GroupType, force?: boolean): Promise<[]>
  • Deletes the channel group. If force is set to 1, the channel group will be deleted even if there are clients within.

    Parameters

    • group: GroupType

      the channelgroup id

    • Default value force: boolean = false

      if set to true the channelgroup will be deleted even when clients are in it

    Returns Promise<[]>

deploySnapshot

  • deploySnapshot(data: string, salt?: undefined | string, password?: undefined | string, keepfiles?: boolean, version?: undefined | string): Promise<[]>
  • displays a snapshot of the selected virtual server containing all settings, groups and known client identities. The data from a server snapshot can be used to restore a virtual servers configuration, channels and permissions using the serversnapshotdeploy command. only supports version 2 (from server 3.10.0)

    Parameters

    • data: string
    • Optional salt: undefined | string

      if a password has been set provide the salt from the response

    • Optional password: undefined | string

      the password which has been set while saving

    • Default value keepfiles: boolean = true

      wether it should keep the file mapping

    • Optional version: undefined | string

      of the snapshot with 0 the version of the current teamspeak server is being used

    Returns Promise<[]>

downloadFile

  • downloadFile(path: string, channel?: ChannelType, cpw?: string): Promise<Buffer>
  • returns the file in the channel with the given path

    Parameters

    • path: string

      the path whith the filename where the file should be uploaded to

    • Default value channel: ChannelType = "0"

      channel id to download from (0 = server)

    • Default value cpw: string = ""

      channel password of the channel which will be uploaded to

    Returns Promise<Buffer>

downloadIcon

  • downloadIcon(id: number): Promise<Buffer>
  • returns an icon with the given id

    Parameters

    • id: number

      the id of the icon to retrieve eg 262672952

    Returns Promise<Buffer>

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

Private evchannelcreated

Private evchanneldeleted

Private evchanneledited

Private evchannelmoved

Private evcliententerview

Private evclientleftview

  • Gets called when a client discconnects from the TeamSpeak Server

    Parameters

    Returns void

Private evclientmoved

eventNames

  • eventNames(): Array<string | symbol>
  • Returns Array<string | symbol>

Private evserveredited

Private evtextmessage

Private evtokenused

execute

  • execute<T>(cmd: string, ...args: executeArgs[]): Promise<T>
  • Sends a raw command to the TeamSpeak Server.

    example

    ts3.execute("clientlist", ["-ip"]) ts3.execute("use", [9987], { clientnickname: "test" })

    Type parameters

    Parameters

    • cmd: string
    • Rest ...args: executeArgs[]

      the command which should get executed on the teamspeak server

    Returns Promise<T>

forceQuit

  • forceQuit(): void

ftCreateDir

  • ftCreateDir(channel: ChannelType, dirname: string, cpw?: undefined | string): Promise<[]>
  • Creates new directory in a channels file repository

    Parameters

    • channel: ChannelType

      the channel id to check for

    • dirname: string

      path to the directory

    • Optional cpw: undefined | string

      the channel password

    Returns Promise<[]>

ftDeleteFile

  • ftDeleteFile(channel: ChannelType, name: string, cpw?: undefined | string): Promise<[]>
  • Deletes one or more files stored in a channels file repository

    Parameters

    • channel: ChannelType

      the channel id to check for

    • name: string

      path to the file to delete

    • Optional cpw: undefined | string

      the channel password

    Returns Promise<[]>

ftGetFileInfo

  • Displays detailed information about one or more specified files stored in a channels file repository.

    Parameters

    • channel: ChannelType

      the channel id to check for

    • name: string

      the filepath to receive

    • Default value cpw: string = ""

      the channel password

    Returns Promise<FTGetFileInfo>

ftGetFileList

  • Displays a list of files and directories stored in the specified channels file repository.

    Parameters

    • channel: ChannelType

      the channel id to check for

    • Default value path: string = "/"

      the path to list

    • Optional cpw: undefined | string

      the channel password

    Returns Promise<FTGetFileEntry[]>

ftInitDownload

  • Initializes a file transfer download. clientftfid is an arbitrary ID to identify the file transfer on client-side. On success, the server generates a new ftkey which is required to start downloading the file through TeamSpeak 3's file transfer interface.

    Parameters

    Returns Promise<FTInitDownload>

ftInitUpload

  • Initializes a file transfer upload. clientftfid is an arbitrary ID to identify the file transfer on client-side. On success, the server generates a new ftkey which is required to start uploading the file through TeamSpeak 3's file transfer interface.

    Parameters

    Returns Promise<FTInitUpload>

ftList

ftRenameFile

  • ftRenameFile(channel: ChannelType, oldname: string, newname: string, tcid?: undefined | string, cpw?: undefined | string, tcpw?: undefined | string): Promise<[]>
  • Renames a file in a channels file repository. If the two parameters tcid and tcpw are specified, the file will be moved into another channels file repository

    Parameters

    • channel: ChannelType

      the channel id to check for

    • oldname: string

      the path to the file which should be renamed

    • newname: string

      the path to the file with the new name

    • Optional tcid: undefined | string

      target channel id if the file should be moved to a different channel

    • Optional cpw: undefined | string

      the channel password from where the file gets renamed

    • Optional tcpw: undefined | string

      the channel password from where the file will get transferred to

    Returns Promise<[]>

ftStop

  • ftStop(serverftfid: number, del?: number): Promise<[]>
  • Stops the running file transfer with server-side ID serverftfid.

    Parameters

    • serverftfid: number

      server file transfer id

    • Default value del: number = 1

    Returns Promise<[]>

getChannelById

getChannelByName

  • Retrieves a Single Channel by the given Channel Name

    Parameters

    • channelName: string

      the name of the channel

    Returns Promise<TeamSpeakChannel | undefined>

getChannelGroupById

getChannelGroupByName

getClientByDbid

getClientById

getClientByName

  • getClientByName(clientNickname: string): Promise<TeamSpeakClient | undefined>
  • Retrieves a Single Client by the given Client Unique Identifier

    Parameters

    • clientNickname: string

      the nickname of the client

    Returns Promise<TeamSpeakClient | undefined>

getClientByUid

getIconId

  • getIconId(permlist: Promise<Permission[]>): Promise<number>
  • gets the icon id of a resolveable Perm List

    Parameters

    • permlist: Promise<Permission[]>

      expects a promise which resolves to a permission list

    Returns Promise<number>

getMaxListeners

  • getMaxListeners(): number

Private getPermBuilder

getServerGroupById

getServerGroupByName

gm

  • gm(msg: string): Promise<[]>
  • Sends a text message to all clients on all virtual servers in the TeamSpeak 3 Server instance.

    Parameters

    • msg: string

      message which will be sent to all instances

    Returns Promise<[]>

Private handleCache

Private handleNewListener

  • handleNewListener(event: string): void
  • subscribes to some query events if necessary

    Parameters

    • event: string

    Returns void

Private handleReady

  • handleReady(): Promise<boolean>
  • handles initial commands after successfully connecting to a TeamSpeak Server

    Returns Promise<boolean>

hostInfo

  • Displays detailed connection information about the server instance including uptime, number of virtual servers online, traffic information, etc.

    Returns Promise<HostInfo>

Private ignoreQueryClient

instanceEdit

  • Changes the server instance configuration using given properties.

    Parameters

    Returns Promise<[]>

instanceInfo

  • Displays the server instance configuration including database revision number, the file transfer port, default group IDs, etc.

    Returns Promise<InstanceInfo>

Private isSubscribedToEvent

  • isSubscribedToEvent(event: string, id?: undefined | string): boolean
  • checks if the server is subscribed to a specific event

    Parameters

    • event: string

      event name which was subscribed to

    • Optional id: undefined | string

      context to check

    Returns boolean

listenerCount

  • listenerCount(type: string | symbol): number
  • Parameters

    • type: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

logAdd

  • logAdd(loglevel: LogLevel, logmsg: string): Promise<[]>
  • Writes a custom entry into the servers log. Depending on your permissions, you'll be able to add entries into the server instance log and/or your virtual servers log. The loglevel parameter specifies the type of the entry

    Parameters

    • loglevel: LogLevel

      level 1 to 4

    • logmsg: string

      message to log

    Returns Promise<[]>

logView

  • logView(lines?: number, reverse?: number, instance?: number, beginPos?: number): Promise<LogView[]>
  • Displays a specified number of entries from the servers log. If instance is set to 1, the server will return lines from the master logfile (ts3server_0.log) instead of the selected virtual server logfile.

    Parameters

    • Default value lines: number = 1000

      amount of lines to receive

    • Default value reverse: number = 0

      invert output (like Array.reverse)

    • Default value instance: number = 0

      instance or virtualserver log

    • Default value beginPos: number = 0

      begin at position

    Returns Promise<LogView[]>

login

  • login(username: string, password: string): Promise<[]>
  • Authenticates with the TeamSpeak 3 Server instance using given ServerQuery login credentials.

    Parameters

    • username: string

      the username which you want to login with

    • password: string

      the password you want to login with

    Returns Promise<[]>

logout

  • logout(): Promise<[]>
  • Deselects the active virtual server and logs out from the server instance.

    Returns Promise<[]>

messageAdd

  • messageAdd(client: ClientType, subject: string, message: string): Promise<[]>
  • Sends an offline message to the client specified by uid.

    Parameters

    • client: ClientType

      client unique identifier

    • subject: string

      subject of the message

    • message: string

      message text

    Returns Promise<[]>

messageDel

  • messageDel(msgid: string): Promise<[]>
  • Sends an offline message to the client specified by uid.

    Parameters

    • msgid: string

      the message id which should be deleted

    Returns Promise<[]>

messageGet

  • Displays an existing offline message with the given id from the inbox.

    Parameters

    • msgid: string

      the message id

    Returns Promise<MessageGet>

messageList

  • Displays a list of offline messages you've received. The output contains the senders unique identifier, the messages subject, etc.

    Returns Promise<MessageEntry[]>

messageUpdate

  • messageUpdate(msgid: string, flag?: boolean): Promise<[]>
  • Displays an existing offline message with the given id from the inbox.

    Parameters

    • msgid: string

      the message id

    • Default value flag: boolean = true

      if flag is set to 1 the message will be marked as read

    Returns Promise<[]>

off

  • off(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

on

  • on(event: "error", listener: (error: Error) => void): this
  • on(event: "ready", listener: () => void): this
  • on(event: "close", listener: (error?: Error) => void): this
  • on(event: "flooding", listener: (error: ResponseError) => void): this
  • on(event: "debug", listener: (event: Debug) => void): this
  • on(event: "clientconnect", listener: (event: ClientConnect) => void): this
  • on(event: "clientdisconnect", listener: (event: ClientDisconnect) => void): this
  • on(event: "tokenused", listener: (event: TokenUsed) => void): this
  • on(event: "textmessage", listener: (event: TextMessage) => void): this
  • on(event: "clientmoved", listener: (event: ClientMoved) => void): this
  • on(event: "serveredit", listener: (event: ServerEdit) => void): this
  • on(event: "channeledit", listener: (event: ChannelEdit) => void): this
  • on(event: "channelcreate", listener: (event: ChannelCreate) => void): this
  • on(event: "channelmoved", listener: (event: ChannelMove) => void): this
  • on(event: "channeldelete", listener: (event: ChannelDelete) => void): this

once

  • once(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

permFind

  • permFind(perm: number | string): Promise<PermFind[]>
  • Retrieves detailed information about all assignments of the permission. The output is similar to permoverview which includes the type and the ID of the client, channel or group associated with the permission.

    Parameters

    • perm: number | string

      perm id or name to retrieve

    Returns Promise<PermFind[]>

permGet

  • permGet(perm: number | string): Promise<PermGet>
  • Retrieves the current value of the permission for your own connection. This can be useful when you need to check your own privileges.

    Parameters

    • perm: number | string

      perm id or name which should be checked

    Returns Promise<PermGet>

permIdGetByName

  • Retrieves the database ID of one or more permissions specified by permsid.

    Parameters

    • permsid: string

      single permission name

    Returns Promise<PermIdGetByName>

permIdsGetByName

  • Retrieves the database ID of one or more permissions specified by permsid.

    Parameters

    • permsid: string[]

      multiple permission names

    Returns Promise<PermIdGetByName[]>

permOverview

  • Displays all permissions assigned to a client for the channel specified with cid. If permid is set to 0, all permissions will be displayed. A permission can be specified by permid or permsid.

    Parameters

    • client: ClientType

      the client database id

    • channel: ChannelType

      one or more permission names

    • Default value perms: number[] | string[] = []

    Returns Promise<PermOverviewEntry[]>

permReset

  • permReset(): Promise<Token>
  • Restores the default permission settings on the selected virtual server and creates a new initial administrator token. Please note that in case of an error during the permreset call - e.g. when the database has been modified or corrupted - the virtual server will be deleted from the database.

    Returns Promise<Token>

permissionList

prependListener

  • prependListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

priorize

  • priorize(): this
  • priorizes the next command, this commands will be first in execution

    Returns this

privilegeKeyAdd

  • privilegeKeyAdd(tokentype: ChannelGroup, group: GroupType, channel: ChannelType, description?: undefined | string, customset?: undefined | string): any
  • privilegeKeyAdd(tokentype: ServerGroup, group: GroupType, channel: undefined, description?: undefined | string, customset?: undefined | string): any
  • Create a new token.+ If type is set to 0, the ID specified with tokenid will be a server group ID. Otherwise, tokenid is used as a channel group ID and you need to provide a valid channel ID using channelid.

    Parameters

    • tokentype: ChannelGroup

      token type

    • group: GroupType

      depends on the type given, add either a valid channelgroup or servergroup

    • channel: ChannelType

      depends on the type given, add a valid channel id

    • Optional description: undefined | string

      token description

    • Optional customset: undefined | string

      token custom set

    Returns any

  • Parameters

    • tokentype: ServerGroup
    • group: GroupType
    • channel: undefined
    • Optional description: undefined | string
    • Optional customset: undefined | string

    Returns any

privilegeKeyDelete

  • privilegeKeyDelete(token: string): Promise<[]>
  • Deletes an existing token matching the token key specified with token.

    Parameters

    • token: string

      the token which should be deleted

    Returns Promise<[]>

privilegeKeyList

privilegeKeyUse

  • privilegeKeyUse(token: string): Promise<[]>
  • Use a token key gain access to a server or channel group. Please note that the server will automatically delete the token after it has been used.

    Parameters

    • token: string

      the token which should be used

    Returns Promise<[]>

queryLoginAdd

  • Adds a new query client login, or enables query login for existing clients. When no virtual server has been selected, the command will create global query logins. Otherwise the command enables query login for existing client, and cldbid must be specified.

    Parameters

    • clientLoginName: string

      the login name

    • Optional client: ClientType

      optional database id or teamspeak client

    Returns Promise<QueryLoginAdd>

queryLoginDel

  • Deletes an existing server query login on selected server. When no virtual server has been selected, deletes global query logins instead.

    Parameters

    • client: ClientType

      client database id or teamspeak client object

    Returns Promise<[]>

queryLoginList

  • queryLoginList(pattern?: undefined | string, start?: undefined | number, duration?: undefined | number): Promise<QueryLoginEntry[]>
  • List existing query client logins. The pattern parameter can include regular characters and SQL wildcard characters (e.g. %). Only displays query logins of the selected virtual server, or all query logins when no virtual server have been selected.

    Parameters

    • Optional pattern: undefined | string

      the pattern to filter for client login names

    • Optional start: undefined | number

      the offset from where clients should be listed

    • Optional duration: undefined | number

      how many clients should be listed

    Returns Promise<QueryLoginEntry[]>

quit

  • quit(): Promise<[]>
  • closes the ServerQuery connection to the TeamSpeak server instance.

    Returns Promise<[]>

rawListeners

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

reconnect

  • reconnect(attempts?: number, timeout?: number): Promise<this>
  • attempts a reconnect to the teamspeak server with full context features

    Parameters

    • Default value attempts: number = 1

      the amount of times it should try to reconnect (-1 = try forever)

    • Default value timeout: number = 2000

      time in ms to wait inbetween reconnect

    Returns Promise<this>

registerEvent

  • registerEvent(event: string, id?: undefined | string): Promise<[]>
  • Subscribes to an Event

    Parameters

    • event: string

      the event on which should be subscribed

    • Optional id: undefined | string

      the channel id, only required when subscribing to the "channel" event

    Returns Promise<[]>

removeAllListeners

  • removeAllListeners(event?: string | symbol): this
  • Parameters

    • Optional event: string | symbol

    Returns this

removeListener

  • removeListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

sendTextMessage

  • sendTextMessage(target: "0", targetmode: SERVER, msg: string): any
  • sendTextMessage(target: ChannelType, targetmode: CHANNEL, msg: string): any
  • sendTextMessage(target: ClientType, targetmode: CLIENT, msg: string): any
  • Sends a text message a specified target. The type of the target is determined by targetmode while target specifies the ID of the recipient, whether it be a virtual server, a channel or a client.

    Parameters

    • target: "0"

      target client id or channel id which should receive the message

    • targetmode: SERVER

      targetmode (1: client, 2: channel, 3: server)

    • msg: string

      the message the client should receive

    Returns any

  • Parameters

    Returns any

  • Parameters

    Returns any

serverCreate

  • Creates a new virtual server using the given properties and displays its ID, port and initial administrator privilege key. If virtualserverPort is not specified, the server will test for the first unused UDP port

    Parameters

    Returns Promise<ServerCreate>

serverDelete

serverEdit

  • Changes the selected virtual servers configuration using given properties. Note that this command accepts multiple properties which means that you're able to change all settings of the selected virtual server at once.

    Parameters

    Returns Promise<[]>

serverGroupAddClient

  • Adds one or more clients to a server group specified with sgid. Please note that a client cannot be added to default groups or template groups

    Parameters

    • client: MultiClientType

      one or more client database ids which should be added

    • group: GroupType

      the servergroup id which the client(s) should be added to

    Returns Promise<[]>

serverGroupAddPerm

serverGroupClientList

serverGroupCopy

  • Creates a copy of the server group specified with ssgid. If tsgid is set to 0, the server will create a new group. To overwrite an existing group, simply set tsgid to the ID of a designated target group. If a target group is set, the name parameter will be ignored.

    Parameters

    • sourceGroup: GroupType

      the source ServerGroup

    • Default value targetGroup: GroupType = "0"

      the target ServerGroup, 0 to create a new Group

    • Default value type: number = 1

      the type of the servergroup (0 = Query Group | 1 = Normal Group)

    • Default value name: string = "foo"

      name of the group

    Returns Promise<ServerGroupCopy>

serverGroupCreate

  • Creates a new server group using the name specified with name. The optional type parameter can be used to create ServerQuery groups and template groups.

    Parameters

    • name: string

      the name of the servergroup

    • Default value type: number = 1

      type of the servergroup

    Returns Promise<TeamSpeakServerGroup>

serverGroupDel

  • serverGroupDel(group: GroupType, force?: boolean): Promise<[]>
  • Deletes the server group. If force is set to 1, the server group will be deleted even if there are clients within.

    Parameters

    • group: GroupType

      the servergroup id

    • Default value force: boolean = false

      if set to 1 the servergoup will be deleted even when clients stil belong to this group

    Returns Promise<[]>

serverGroupDelClient

  • Removes one or more clients from the server group specified with sgid.

    Parameters

    • client: MultiClientType

      one or more client database ids which should be added

    • group: GroupType

      the servergroup id which the client(s) should be removed from

    Returns Promise<[]>

serverGroupDelPerm

  • serverGroupDelPerm(group: GroupType, perm: string | number): Promise<[]>
  • Removes a set of specified permissions from the server group. A permission can be specified by permid or permsid.

    Parameters

    • group: GroupType

      the servergroup id

    • perm: string | number

      the permid or permsid

    Returns Promise<[]>

serverGroupList

  • Displays a list of server groups available. Depending on your permissions, the output may also contain global ServerQuery groups and template groups.

    Parameters

    Returns Promise<TeamSpeakServerGroup[]>

serverGroupPermList

  • serverGroupPermList(group: GroupType, permsid?: boolean): Promise<Permission<{ sgid: string }>[]>
  • Displays a list of permissions assigned to the server group specified with sgid.

    Parameters

    • group: GroupType
    • Default value permsid: boolean = false

      if the permsid option is set to true the output will contain the permission names

    Returns Promise<Permission<{ sgid: string }>[]>

serverGroupPrivilegeKeyAdd

  • serverGroupPrivilegeKeyAdd(group: GroupType, description?: undefined | string, customset?: undefined | string): Promise<Token>
  • Create a new privilegekey token for a ServerGroup with the given description

    Parameters

    • group: GroupType

      servergroup which should be generated the token for

    • Optional description: undefined | string

      token description

    • Optional customset: undefined | string

    Returns Promise<Token>

serverGroupRename

  • serverGroupRename(group: GroupType, name: string): Promise<[]>
  • Changes the name of the server group

    Parameters

    • group: GroupType

      the servergroup id

    • name: string

      new name of the servergroup

    Returns Promise<[]>

serverGroupsByClientId

serverIdGetByPort

  • Displays the database ID of the virtual server running on the UDP port

    Parameters

    • virtualserverPort: number

      the server port where data should be retrieved

    Returns Promise<ServerIdGetByPort>

serverInfo

  • Displays detailed configuration information about the selected virtual server including unique ID, number of clients online, configuration, etc.

    Returns Promise<ServerInfo>

serverList

serverProcessStop

  • serverProcessStop(reasonmsg?: undefined | string): Promise<[]>
  • Stops the entire TeamSpeak 3 Server instance by shutting down the process.

    Parameters

    • Optional reasonmsg: undefined | string

      specifies a text message that is sent to the clients before the client disconnects (requires TeamSpeak Server 3.2.0 or newer).

    Returns Promise<[]>

serverStart

  • Starts the virtual server. Depending on your permissions, you're able to start either your own virtual server only or all virtual servers in the server instance.

    Parameters

    Returns Promise<[]>

serverStop

  • serverStop(server: ServerType, reasonmsg?: undefined | string): Promise<[]>
  • Stops the virtual server. Depending on your permissions, you're able to stop either your own virtual server only or all virtual servers in the server instance.

    Parameters

    • server: ServerType

      the server id to stop

    • Optional reasonmsg: undefined | string

      Specifies a text message that is sent to the clients before the client disconnects (requires TeamSpeak Server 3.2.0 or newer).

    Returns Promise<[]>

serverTempPasswordAdd

  • Sets a new temporary server password specified with pw. The temporary password will be valid for the number of seconds specified with duration. The client connecting with this password will automatically join the channel specified with tcid. If tcid is set to 0, the client will join the default channel.

    Parameters

    Returns Promise<[]>

serverTempPasswordDel

  • serverTempPasswordDel(pw: string): Promise<[]>
  • Deletes the temporary server password specified with pw.

    Parameters

    • pw: string

      the password to delete

    Returns Promise<[]>

serverTempPasswordList

  • Returns a list of active temporary server passwords. The output contains the clear-text password, the nickname and unique identifier of the creating client.

    Returns Promise<ServerTempPasswordEntry[]>

setClientChannelGroup

  • Sets the channel group of a client

    Parameters

    • group: GroupType

      the channelgroup which the client should get assigned

    • channel: ChannelType

      the channel in which the client should be assigned the group

    • client: ClientType

      the client database id which should be added to the group

    Returns Promise<[]>

setMaxListeners

  • setMaxListeners(n: number): this

unregisterEvent

  • unregisterEvent(): Promise<[]>

Private updateContext

  • updateContext(data: Partial<Context>): this
  • updates the context with new data

    Parameters

    • data: Partial<Context>

      the data to update the context with

    Returns this

Private updateContextReject

  • updateContextReject<T>(context: Partial<Context>): (Anonymous function)
  • updates the context when the inner callback gets called and throws the first parameter which is an error

    Type parameters

    Parameters

    • context: Partial<Context>

      context data to update

    Returns (Anonymous function)

Private updateContextResolve

  • updateContextResolve<T>(context: Partial<Context>): (Anonymous function)
  • updates the context when the inner callback gets called and returns the first parameter

    Type parameters

    • T

    Parameters

    • context: Partial<Context>

      context data to update

    Returns (Anonymous function)

uploadFile

  • uploadFile(path: string, data: string | Buffer, channel?: ChannelType, cpw?: string): Promise<void>
  • uploads a file

    Parameters

    • path: string

      the path whith the filename where the file should be uploaded to

    • data: string | Buffer

      the data to upload

    • Default value channel: ChannelType = "0"

      channel id to upload to (0 = server)

    • Default value cpw: string = ""

      channel password of the channel which will be uploaded to

    Returns Promise<void>

uploadIcon

  • uploadIcon(data: Buffer): Promise<number>
  • uploads an icon to the teamspeak server and returns its id

    Parameters

    • data: Buffer

      icon buffer to upload

    Returns Promise<number>

useByPort

  • useByPort(port: number, clientNickname?: undefined | string): Promise<[]>
  • Selects the virtual server specified with the port to allow further interaction.

    Parameters

    • port: number

      the port the server runs on

    • Optional clientNickname: undefined | string

      set nickname when selecting a server

    Returns Promise<[]>

useBySid

  • useBySid(server: ServerType, clientNickname?: undefined | string): Promise<[]>
  • Selects the virtual server specified with the sid to allow further interaction.

    Parameters

    • server: ServerType

      the server id

    • Optional clientNickname: undefined | string

      set nickname when selecting a server

    Returns Promise<[]>

version

  • version(refresh?: boolean): Promise<undefined | Version>
  • Displays the servers version information including platform and build number.

    Parameters

    • Default value refresh: boolean = false

      if this parameter has been set it will send a command to the server otherwise will use the cached info

    Returns Promise<undefined | Version>

whoami

  • returns information about your current ServerQuery connection including your loginname, etc.

    Returns Promise<Whoami>

Static connect

Static filter

  • filter<T>(array: T[], filter: Partial<T>): T[]
  • filters an array with given filter

    Type parameters

    Parameters

    • array: T[]

      the array which should get filtered

    • filter: Partial<T>

      filter object

    Returns T[]

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • deprecated

    since v4.0.0

    Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Static singleResponse

  • singleResponse<T>(input: T | T[]): T
  • retrieves the first element of an array

    Type parameters

    • T

    Parameters

    • input: T | T[]

      the response input

    Returns T

Static toArray

  • toArray<T>(input: T | T[]): T[]
  • Transforms an Input to an Array

    Type parameters

    • T

    Parameters

    • input: T | T[]

      input data which should be converted to an array

    Returns T[]

Static wait

  • wait(time: number): Promise<unknown>
  • waits a set time of ms

    Parameters

    • time: number

      time in ms to wait

    Returns Promise<unknown>

Object literals

Private context

context: object

events

events: never[] = []

selectType

selectType: NONE = SelectType.NONE

selected

selected: 0 = 0

Generated using TypeDoc