• 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

84.38
/src/node/ChannelGroup.ts
1
import { Abstract } from "./Abstract"
11✔
2
import { TeamSpeak } from "../TeamSpeak"
3
import { ChannelGroupEntry } from "../types/ResponseTypes"
4
import { TeamSpeakChannel } from "./Channel"
5
import { TeamSpeakClient } from "./Client"
6
import { Permission } from "../util/Permission"
7

8
export class TeamSpeakChannelGroup extends Abstract<ChannelGroupEntry> {
11✔
9

10
  constructor(parent: TeamSpeak, list: ChannelGroupEntry) {
11
    super(parent, list, "channelgroup")
34✔
12
  }
13

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

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

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

26
  get iconid() {
27
    return super.getPropertyByName("iconid")!
1✔
28
  }
29

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

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

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

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

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

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

54
  /**
55
   * Deletes the channel group. If force is set to 1, the channel group will be deleted even if there are clients within.
56
   * @param force if set to 1 the channelgroup will be deleted even when clients are in it
57
   */
58
  del(force?: boolean) {
59
    return super.getParent().deleteChannelGroup(this, force)
2✔
60
  }
61

62
  /**
63
   * Creates a copy of the channel group. If tcgid is set to 0, the server will create a new group.
64
   * To overwrite an existing group, simply set tcgid to the ID of a designated target group.
65
   * If a target group is set, the name parameter will be ignored.
66
   * @param tcgid the target group, 0 to create a new group
67
   * @param type the type of the group (0 = Template Group | 1 = Normal Group)
68
   * @param name name of the group
69
   */
70
  copy(tcgid: string|TeamSpeakChannelGroup, type: number, name: string) {
71
    return super.getParent().channelGroupCopy(this, tcgid, type, name)
1✔
72
  }
73

74
  /**
75
   * changes the name of the channelgroup
76
   * @param name new name of the group
77
   */
78
  rename(name: string) {
79
    return super.getParent().channelGroupRename(this, name)
1✔
80
  }
81

82
  /**
83
   * returns a list of permissions assigned to the channel group specified with cgid.
84
   * @param permsid if the permsid option is set to true the output will contain the permission names
85
   */
86
  permList(permsid: boolean = false) {
1✔
87
    return super.getParent().channelGroupPermList(this, permsid)
4✔
88
  }
89

90
  /**
91
   * Adds a specified permissions to the channel group.
92
   * A permission can be specified by permid or permsid.
93
   * @param perm the permission object
94
   */
95
  addPerm(perm: Permission.PermType) {
96
    return super.getParent().channelGroupAddPerm(this, perm)
1✔
97
  }
98

99
  /**
100
   * Adds a specified permissions to the channel group.
101
   * A permission can be specified by permid or permsid.
102
   */
103
  createPerm() {
104
    return super.getParent().channelGroupAddPerm(this)
×
105
  }
106

107
  /**
108
   * Removes a set of specified permissions from the channel group.
109
   * A permission can be specified by permid or permsid.
110
   * @param perm the permid or permsid
111
   */
112
  delPerm(perm: string|number) {
113
    return super.getParent().channelGroupDelPerm(this, perm)
1✔
114
  }
115

116
  /**
117
   * sets the channel group of a client
118
   * @param channel the channel in which the client should be assigned the Group
119
   * @param client the client database id which should be added to the Group
120
   */
121
  setClient(channel: string|TeamSpeakChannel, client: string|TeamSpeakClient) {
122
    return super.getParent().setClientChannelGroup(this, channel, client)
1✔
123
  }
124

125
  /**
126
   * returns the ids of all clients currently residing in the channelgroup
127
   * @param channel the channel id
128
   */
129
  clientList(channel: string|TeamSpeakChannel) {
130
    return super.getParent().channelGroupClientList(this, channel)
1✔
131
  }
132

133
  /** returns a buffer with the icon of the channelgroup */
134
  getIcon() {
135
    return this.getIconId().then(name => super.getParent().downloadIcon(name))
1✔
136
  }
137

138
  /** gets the icon name of the channelgroup */
139
  getIconId() {
140
    return super.getParent().getIconId(this.permList(true))
2✔
141
  }
142

143
  /** retrieves the client id from a string or teamspeak client */
144
  static getId<T extends TeamSpeakChannelGroup.GroupType>(channel?: T): T extends undefined ? undefined : string
145
  static getId(channel?: TeamSpeakChannelGroup.GroupType): string|undefined {
146
    return channel instanceof TeamSpeakChannelGroup ? channel.cgid : channel
32✔
147
  }
148

149
  /** retrieves the clients from an array */
150
  static getMultipleIds(client: TeamSpeakChannelGroup.MultiGroupType): string[] {
151
    const list = Array.isArray(client) ? client : [client]
×
152
    return list.map(c => TeamSpeakChannelGroup.getId(c)) as string[]
×
153
  }
154

155
}
156
export namespace TeamSpeakChannelGroup {
157
  export type GroupType = string|TeamSpeakChannelGroup
158
  export type MultiGroupType = string[]|TeamSpeakChannelGroup[]|GroupType
159
}
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