• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Multivit4min / TS3-NodeJS-Library / 5461107410

pending completion
5461107410

push

github

Multivit4min
remove support for node v14 update deploy to use node 18

330 of 433 branches covered (76.21%)

Branch coverage included in aggregate %.

1150 of 1191 relevant lines covered (96.56%)

59.71 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.5
/src/node/Channel.ts
1
import { Abstract } from "./Abstract"
11✔
2
import { TeamSpeak } from "../TeamSpeak"
3
import { ChannelEntry, ClientEntry } from "../types/ResponseTypes"
4
import { ChannelEdit } from "../types/PropertyTypes"
5
import { TeamSpeakClient } from "./Client"
6
import { Permission } from "../util/Permission"
7

8
export class TeamSpeakChannel extends Abstract<ChannelEntry> {
11✔
9

10
  constructor(parent: TeamSpeak, list: ChannelEntry) {
11
    super(parent, list, "channel")
55✔
12
  }
13

14
  get cid() {
15
    return super.getPropertyByName("cid")!
21✔
16
  }
17

18
  get pid() {
19
    return super.getPropertyByName("pid")!
1✔
20
  }
21

22
  get order() {
23
    return super.getPropertyByName("channelOrder")!
1✔
24
  }
25

26
  get name() {
27
    return super.getPropertyByName("channelName")!
3✔
28
  }
29

30
  get topic() {
31
    return super.getPropertyByName("channelTopic")
1✔
32
  }
33

34
  get flagDefault() {
35
    return super.getPropertyByName("channelFlagDefault")
1✔
36
  }
37

38
  get flagPassword() {
39
    return super.getPropertyByName("channelFlagPassword")
1✔
40
  }
41

42
  get flagPermanent() {
43
    return super.getPropertyByName("channelFlagPermanent")
1✔
44
  }
45

46
  get flagSemiPermanent() {
47
    return super.getPropertyByName("channelFlagSemiPermanent")
1✔
48
  }
49

50
  get codec() {
51
    return super.getPropertyByName("channelCodec")
1✔
52
  }
53

54
  get codecQuality() {
55
    return super.getPropertyByName("channelCodecQuality")
1✔
56
  }
57

58
  get neededTalkPower() {
59
    return super.getPropertyByName("channelNeededTalkPower")
1✔
60
  }
61

62
  get iconId() {
63
    return super.getPropertyByName("channelIconId")
1✔
64
  }
65

66
  get secondsEmpty() {
67
    return super.getPropertyByName("secondsEmpty")
1✔
68
  }
69

70
  get totalClientsFamily() {
71
    return super.getPropertyByName("totalClientsFamily")
1✔
72
  }
73

74
  get maxclients() {
75
    return super.getPropertyByName("channelMaxclients")
1✔
76
  }
77

78
  get maxfamilyclients() {
79
    return super.getPropertyByName("channelMaxfamilyclients")
1✔
80
  }
81

82
  get totalClients() {
83
    return super.getPropertyByName("totalClients")!
1✔
84
  }
85

86
  get neededSubscribePower() {
87
    return super.getPropertyByName("channelNeededSubscribePower")!
1✔
88
  }
89

90
  get bannerGfxUrl() {
91
    return super.getPropertyByName("channelBannerGfxUrl")!
1✔
92
  }
93

94
  get bannerMode() {
95
    return super.getPropertyByName("channelBannerMode")!
1✔
96
  }
97

98
  /** returns detailed configuration information about a channel including ID, topic, description, etc */
99
  getInfo() {
100
    return super.getParent().channelInfo(this)
1✔
101
  }
102

103
  /**
104
   * Moves a channel to a new parent channel with the ID cpid.
105
   * If order is specified, the channel will be sorted right under the channel with the specified ID.
106
   * If order is set to 0, the channel will be sorted right below the new parent.
107
   * @param parent channel parent id
108
   * @param order channel sort order
109
   */
110
  move(parent: string|TeamSpeakChannel, order: number = 0) {
1✔
111
    return super.getParent().channelMove(this, parent, order)
2✔
112
  }
113

114
  /**
115
   * sends a message to the specified channel
116
   * @param msg message which should be sent to the channel
117
   */
118
  message(msg: string) {
119
    return this.getParent().sendChannelMessage(this, msg)
×
120
  }
121

122
  /**
123
   * Deletes an existing channel by ID.
124
   * If force is set to 1, the channel will be deleted even if there are clients within.
125
   * The clients will be kicked to the default channel with an appropriate reason message.
126
   * @param {number} force if set to 1 the channel will be deleted even when clients are in it
127
   */
128
  del(force: boolean = false) {
1✔
129
    return super.getParent().channelDelete(this, force)
2✔
130
  }
131

132
  /**
133
   * 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.
134
   * @param properties the properties of the channel which should get changed
135
   */
136
  edit(properties: ChannelEdit) {
137
    return super.getParent().channelEdit(this, properties)
1✔
138
  }
139

140
  /**
141
   * Displays a list of permissions defined for a channel.
142
   * @param permsid whether the permsid should be displayed aswell
143
   */
144
  permList(permsid: boolean = false) {
1✔
145
    return super.getParent().channelPermList(this, permsid)
4✔
146
  }
147

148
  /**
149
   * Adds a set of specified permissions to a channel.
150
   * Multiple permissions can be added by providing the two parameters of each permission.
151
   * A permission can be specified by permid or permsid.
152
   * @param perm permission object to set
153
   */
154
  setPerm(perm: Permission.PermType) {
155
    return super.getParent().channelSetPerm(this, perm)
1✔
156
  }
157

158
  /**
159
   * Adds a permission to a channel
160
   * Multiple permissions can be added by providing the two parameters of each permission.
161
   * A permission can be specified by permid or permsid.
162
   * @param perm permission object to set
163
   */
164
  createPerm() {
165
    return super.getParent().channelSetPerm(this, undefined)
×
166
  }
167

168
  /**
169
   * Removes a set of specified permissions from a channel.
170
   * Multiple permissions can be removed at once.
171
   * A permission can be specified by permid or permsid.
172
   * @param perm the permid or permsid
173
   */
174
  delPerm(perm: string|number) {
175
    return super.getParent().channelDelPerm(this, perm)
1✔
176
  }
177

178
  /**
179
   * Gets a List of Clients in the current Channel
180
   * @param filter the filter object
181
   */
182
  getClients(filter: Partial<ClientEntry> = {}): Promise<TeamSpeakClient[]> {
1✔
183
    filter.cid = this.cid
1✔
184
    return super.getParent().clientList(filter)
1✔
185
  }
186

187
  /** returns a buffer with the icon of the channel */
188
  getIcon(): Promise<Buffer> {
189
    return this.getIconId().then(id => super.getParent().downloadIcon(id))
1✔
190
  }
191

192
  /** returns the icon name of the channel */
193
  getIconId() {
194
    return super.getParent().getIconId(this.permList(true))
2✔
195
  }
196

197
  /** retrieves the client id from a string or teamspeak client */
198
  static getId<T extends TeamSpeakChannel.ChannelType>(channel?: T): T extends undefined ? undefined : string
199
  static getId(channel?: TeamSpeakChannel.ChannelType): string|undefined {
200
    return channel instanceof TeamSpeakChannel ? channel.cid : channel
76✔
201
  }
202

203
  /** retrieves the clients from an array */
204
  static getMultipleIds(channels: TeamSpeakChannel.MultiChannelType) {
205
    const list = Array.isArray(channels) ? channels : [channels]
×
206
    return list.map(c => TeamSpeakChannel.getId(c)) as string[]
×
207
  }
208

209
}
210

211
export namespace TeamSpeakChannel {
212
  export type ChannelType = string|TeamSpeakChannel
213
  export type MultiChannelType = string[]|TeamSpeakChannel[]|ChannelType
214
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc