@honeybbq/teamspeak 0.0.1 → 1.0.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +726 -2
- package/dist/client/abort.d.ts +5 -0
- package/dist/client/abort.d.ts.map +1 -0
- package/dist/client/abort.js +23 -0
- package/dist/client/abort.js.map +1 -0
- package/dist/client/address.d.ts +17 -0
- package/dist/client/address.d.ts.map +1 -0
- package/dist/client/address.js +66 -0
- package/dist/client/address.js.map +1 -0
- package/dist/client/api/voice.d.ts +24 -0
- package/dist/client/api/voice.d.ts.map +1 -0
- package/dist/client/api/voice.js +33 -0
- package/dist/client/api/voice.js.map +1 -0
- package/dist/client/capabilities.d.ts +68 -0
- package/dist/client/capabilities.d.ts.map +1 -0
- package/dist/client/capabilities.js +59 -0
- package/dist/client/capabilities.js.map +1 -0
- package/dist/client/client.d.ts +196 -0
- package/dist/client/client.d.ts.map +1 -0
- package/dist/client/client.js +1523 -0
- package/dist/client/client.js.map +1 -0
- package/dist/client/commands.d.ts +66 -0
- package/dist/client/commands.d.ts.map +1 -0
- package/dist/client/commands.js +162 -0
- package/dist/client/commands.js.map +1 -0
- package/dist/client/crypto/crypt-ops.d.ts +7 -0
- package/dist/client/crypto/crypt-ops.d.ts.map +1 -0
- package/dist/client/crypto/crypt-ops.js +2 -0
- package/dist/client/crypto/crypt-ops.js.map +1 -0
- package/dist/client/crypto/crypt.d.ts +37 -0
- package/dist/client/crypto/crypt.d.ts.map +1 -0
- package/dist/client/crypto/crypt.js +203 -0
- package/dist/client/crypto/crypt.js.map +1 -0
- package/dist/client/crypto/eax.d.ts +12 -0
- package/dist/client/crypto/eax.d.ts.map +1 -0
- package/dist/client/crypto/eax.js +118 -0
- package/dist/client/crypto/eax.js.map +1 -0
- package/dist/client/crypto/identity.d.ts +97 -0
- package/dist/client/crypto/identity.d.ts.map +1 -0
- package/dist/client/crypto/identity.js +412 -0
- package/dist/client/crypto/identity.js.map +1 -0
- package/dist/client/crypto/index.d.ts +7 -0
- package/dist/client/crypto/index.d.ts.map +1 -0
- package/dist/client/crypto/index.js +5 -0
- package/dist/client/crypto/index.js.map +1 -0
- package/dist/client/crypto/primitives.d.ts +43 -0
- package/dist/client/crypto/primitives.d.ts.map +1 -0
- package/dist/client/crypto/primitives.js +116 -0
- package/dist/client/crypto/primitives.js.map +1 -0
- package/dist/client/diagnostics.d.ts +45 -0
- package/dist/client/diagnostics.d.ts.map +1 -0
- package/dist/client/diagnostics.js +30 -0
- package/dist/client/diagnostics.js.map +1 -0
- package/dist/client/discovery/index.d.ts +2 -0
- package/dist/client/discovery/index.d.ts.map +1 -0
- package/dist/client/discovery/index.js +2 -0
- package/dist/client/discovery/index.js.map +1 -0
- package/dist/client/discovery/resolver.d.ts +26 -0
- package/dist/client/discovery/resolver.d.ts.map +1 -0
- package/dist/client/discovery/resolver.js +275 -0
- package/dist/client/discovery/resolver.js.map +1 -0
- package/dist/client/errors.d.ts +82 -0
- package/dist/client/errors.d.ts.map +1 -0
- package/dist/client/errors.js +201 -0
- package/dist/client/errors.js.map +1 -0
- package/dist/client/events.d.ts +3 -0
- package/dist/client/events.d.ts.map +1 -0
- package/dist/client/events.js +8 -0
- package/dist/client/events.js.map +1 -0
- package/dist/client/handshake/crypt-handshake.d.ts +17 -0
- package/dist/client/handshake/crypt-handshake.d.ts.map +1 -0
- package/dist/client/handshake/crypt-handshake.js +128 -0
- package/dist/client/handshake/crypt-handshake.js.map +1 -0
- package/dist/client/handshake/crypt-init2.d.ts +7 -0
- package/dist/client/handshake/crypt-init2.d.ts.map +1 -0
- package/dist/client/handshake/crypt-init2.js +37 -0
- package/dist/client/handshake/crypt-init2.js.map +1 -0
- package/dist/client/handshake/index.d.ts +4 -0
- package/dist/client/handshake/index.d.ts.map +1 -0
- package/dist/client/handshake/index.js +4 -0
- package/dist/client/handshake/index.js.map +1 -0
- package/dist/client/handshake/license.d.ts +35 -0
- package/dist/client/handshake/license.d.ts.map +1 -0
- package/dist/client/handshake/license.js +169 -0
- package/dist/client/handshake/license.js.map +1 -0
- package/dist/client/handshake.d.ts +27 -0
- package/dist/client/handshake.d.ts.map +1 -0
- package/dist/client/handshake.js +126 -0
- package/dist/client/handshake.js.map +1 -0
- package/dist/client/helpers.d.ts +6 -0
- package/dist/client/helpers.d.ts.map +1 -0
- package/dist/client/helpers.js +13 -0
- package/dist/client/helpers.js.map +1 -0
- package/dist/client/hooks.d.ts +7 -0
- package/dist/client/hooks.d.ts.map +1 -0
- package/dist/client/hooks.js +28 -0
- package/dist/client/hooks.js.map +1 -0
- package/dist/client/index.d.ts +26 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +28 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/reconnect.d.ts +12 -0
- package/dist/client/reconnect.d.ts.map +1 -0
- package/dist/client/reconnect.js +44 -0
- package/dist/client/reconnect.js.map +1 -0
- package/dist/client/throttle.d.ts +20 -0
- package/dist/client/throttle.d.ts.map +1 -0
- package/dist/client/throttle.js +83 -0
- package/dist/client/throttle.js.map +1 -0
- package/dist/client/trace.d.ts +223 -0
- package/dist/client/trace.d.ts.map +1 -0
- package/dist/client/trace.js +13 -0
- package/dist/client/trace.js.map +1 -0
- package/dist/client/transfer.d.ts +111 -0
- package/dist/client/transfer.d.ts.map +1 -0
- package/dist/client/transfer.js +243 -0
- package/dist/client/transfer.js.map +1 -0
- package/dist/client/transport/generation-window.d.ts +30 -0
- package/dist/client/transport/generation-window.d.ts.map +1 -0
- package/dist/client/transport/generation-window.js +97 -0
- package/dist/client/transport/generation-window.js.map +1 -0
- package/dist/client/transport/handler.d.ts +61 -0
- package/dist/client/transport/handler.d.ts.map +1 -0
- package/dist/client/transport/handler.js +793 -0
- package/dist/client/transport/handler.js.map +1 -0
- package/dist/client/transport/index.d.ts +6 -0
- package/dist/client/transport/index.d.ts.map +1 -0
- package/dist/client/transport/index.js +5 -0
- package/dist/client/transport/index.js.map +1 -0
- package/dist/client/transport/packet.d.ts +36 -0
- package/dist/client/transport/packet.d.ts.map +1 -0
- package/dist/client/transport/packet.js +55 -0
- package/dist/client/transport/packet.js.map +1 -0
- package/dist/client/transport/quicklz.d.ts +24 -0
- package/dist/client/transport/quicklz.d.ts.map +1 -0
- package/dist/client/transport/quicklz.js +179 -0
- package/dist/client/transport/quicklz.js.map +1 -0
- package/dist/client/types.d.ts +226 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client/types.js +39 -0
- package/dist/client/types.js.map +1 -0
- package/dist/core/api/channels.d.ts +182 -0
- package/dist/core/api/channels.d.ts.map +1 -0
- package/dist/core/api/channels.js +155 -0
- package/dist/core/api/channels.js.map +1 -0
- package/dist/core/api/clients.d.ts +304 -0
- package/dist/core/api/clients.d.ts.map +1 -0
- package/dist/core/api/clients.js +260 -0
- package/dist/core/api/clients.js.map +1 -0
- package/dist/core/api/command.d.ts +305 -0
- package/dist/core/api/command.d.ts.map +1 -0
- package/dist/core/api/command.js +363 -0
- package/dist/core/api/command.js.map +1 -0
- package/dist/core/api/files.d.ts +153 -0
- package/dist/core/api/files.d.ts.map +1 -0
- package/dist/core/api/files.js +181 -0
- package/dist/core/api/files.js.map +1 -0
- package/dist/core/api/groups.d.ts +248 -0
- package/dist/core/api/groups.d.ts.map +1 -0
- package/dist/core/api/groups.js +271 -0
- package/dist/core/api/groups.js.map +1 -0
- package/dist/core/api/moderation.d.ts +205 -0
- package/dist/core/api/moderation.d.ts.map +1 -0
- package/dist/core/api/moderation.js +209 -0
- package/dist/core/api/moderation.js.map +1 -0
- package/dist/core/api/parse.d.ts +16 -0
- package/dist/core/api/parse.d.ts.map +1 -0
- package/dist/core/api/parse.js +40 -0
- package/dist/core/api/parse.js.map +1 -0
- package/dist/core/api/server.d.ts +310 -0
- package/dist/core/api/server.d.ts.map +1 -0
- package/dist/core/api/server.js +290 -0
- package/dist/core/api/server.js.map +1 -0
- package/dist/core/command/command.d.ts +20 -0
- package/dist/core/command/command.d.ts.map +1 -0
- package/dist/core/command/command.js +112 -0
- package/dist/core/command/command.js.map +1 -0
- package/dist/core/command/ids.d.ts +125 -0
- package/dist/core/command/ids.d.ts.map +1 -0
- package/dist/core/command/ids.js +85 -0
- package/dist/core/command/ids.js.map +1 -0
- package/dist/core/command/parser.d.ts +17 -0
- package/dist/core/command/parser.d.ts.map +1 -0
- package/dist/core/command/parser.js +65 -0
- package/dist/core/command/parser.js.map +1 -0
- package/dist/core/command/request.d.ts +61 -0
- package/dist/core/command/request.d.ts.map +1 -0
- package/dist/core/command/request.js +64 -0
- package/dist/core/command/request.js.map +1 -0
- package/dist/core/command/responses.d.ts +59 -0
- package/dist/core/command/responses.d.ts.map +1 -0
- package/dist/core/command/responses.js +74 -0
- package/dist/core/command/responses.js.map +1 -0
- package/dist/core/command-name.d.ts +333 -0
- package/dist/core/command-name.d.ts.map +1 -0
- package/dist/core/command-name.js +331 -0
- package/dist/core/command-name.js.map +1 -0
- package/dist/core/enums.d.ts +146 -0
- package/dist/core/enums.d.ts.map +1 -0
- package/dist/core/enums.js +132 -0
- package/dist/core/enums.js.map +1 -0
- package/dist/core/errorcode.d.ts +413 -0
- package/dist/core/errorcode.d.ts.map +1 -0
- package/dist/core/errorcode.js +410 -0
- package/dist/core/errorcode.js.map +1 -0
- package/dist/core/errors.d.ts +111 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +233 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/events.d.ts +207 -0
- package/dist/core/events.d.ts.map +1 -0
- package/dist/core/events.js +6 -0
- package/dist/core/events.js.map +1 -0
- package/dist/core/helpers.d.ts +42 -0
- package/dist/core/helpers.d.ts.map +1 -0
- package/dist/core/helpers.js +156 -0
- package/dist/core/helpers.js.map +1 -0
- package/dist/core/index.d.ts +35 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +34 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/internal.d.ts +23 -0
- package/dist/core/internal.d.ts.map +1 -0
- package/dist/core/internal.js +20 -0
- package/dist/core/internal.js.map +1 -0
- package/dist/core/middleware.d.ts +14 -0
- package/dist/core/middleware.d.ts.map +1 -0
- package/dist/core/middleware.js +18 -0
- package/dist/core/middleware.js.map +1 -0
- package/dist/core/notification-name.d.ts +154 -0
- package/dist/core/notification-name.d.ts.map +1 -0
- package/dist/core/notification-name.js +152 -0
- package/dist/core/notification-name.js.map +1 -0
- package/dist/core/notifications.d.ts +43 -0
- package/dist/core/notifications.d.ts.map +1 -0
- package/dist/core/notifications.js +116 -0
- package/dist/core/notifications.js.map +1 -0
- package/dist/core/permission-name.d.ts +533 -0
- package/dist/core/permission-name.d.ts.map +1 -0
- package/dist/core/permission-name.js +531 -0
- package/dist/core/permission-name.js.map +1 -0
- package/dist/core/permission.d.ts +31 -0
- package/dist/core/permission.d.ts.map +1 -0
- package/dist/core/permission.js +20 -0
- package/dist/core/permission.js.map +1 -0
- package/dist/core/property-name.d.ts +403 -0
- package/dist/core/property-name.d.ts.map +1 -0
- package/dist/core/property-name.js +405 -0
- package/dist/core/property-name.js.map +1 -0
- package/dist/core/reason.d.ts +39 -0
- package/dist/core/reason.d.ts.map +1 -0
- package/dist/core/reason.js +36 -0
- package/dist/core/reason.js.map +1 -0
- package/dist/core/reconnect.d.ts +59 -0
- package/dist/core/reconnect.d.ts.map +1 -0
- package/dist/core/reconnect.js +55 -0
- package/dist/core/reconnect.js.map +1 -0
- package/dist/core/types.d.ts +110 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +27 -0
- package/dist/core/types.js.map +1 -0
- package/dist/query/client.d.ts +194 -0
- package/dist/query/client.d.ts.map +1 -0
- package/dist/query/client.js +967 -0
- package/dist/query/client.js.map +1 -0
- package/dist/query/errors.d.ts +61 -0
- package/dist/query/errors.d.ts.map +1 -0
- package/dist/query/errors.js +100 -0
- package/dist/query/errors.js.map +1 -0
- package/dist/query/index.d.ts +36 -0
- package/dist/query/index.d.ts.map +1 -0
- package/dist/query/index.js +34 -0
- package/dist/query/index.js.map +1 -0
- package/dist/query/knownhosts.d.ts +61 -0
- package/dist/query/knownhosts.d.ts.map +1 -0
- package/dist/query/knownhosts.js +223 -0
- package/dist/query/knownhosts.js.map +1 -0
- package/dist/query/lines.d.ts +14 -0
- package/dist/query/lines.d.ts.map +1 -0
- package/dist/query/lines.js +29 -0
- package/dist/query/lines.js.map +1 -0
- package/dist/query/options.d.ts +187 -0
- package/dist/query/options.d.ts.map +1 -0
- package/dist/query/options.js +213 -0
- package/dist/query/options.js.map +1 -0
- package/dist/query/reconnect.d.ts +29 -0
- package/dist/query/reconnect.d.ts.map +1 -0
- package/dist/query/reconnect.js +87 -0
- package/dist/query/reconnect.js.map +1 -0
- package/dist/query/ssh.d.ts +345 -0
- package/dist/query/ssh.d.ts.map +1 -0
- package/dist/query/ssh.js +241 -0
- package/dist/query/ssh.js.map +1 -0
- package/dist/query/stream.d.ts +38 -0
- package/dist/query/stream.d.ts.map +1 -0
- package/dist/query/stream.js +70 -0
- package/dist/query/stream.js.map +1 -0
- package/dist/query/tcp.d.ts +38 -0
- package/dist/query/tcp.d.ts.map +1 -0
- package/dist/query/tcp.js +53 -0
- package/dist/query/tcp.js.map +1 -0
- package/dist/query/transport.d.ts +36 -0
- package/dist/query/transport.d.ts.map +1 -0
- package/dist/query/transport.js +2 -0
- package/dist/query/transport.js.map +1 -0
- package/dist/query/web.d.ts +54 -0
- package/dist/query/web.d.ts.map +1 -0
- package/dist/query/web.js +146 -0
- package/dist/query/web.js.map +1 -0
- package/dist/versions/index.d.ts +3094 -0
- package/dist/versions/index.d.ts.map +1 -0
- package/dist/versions/index.js +9237 -0
- package/dist/versions/index.js.map +1 -0
- package/package.json +118 -4
- package/src/client/abort.ts +24 -0
- package/src/client/address.ts +74 -0
- package/src/client/api/voice.ts +61 -0
- package/src/client/capabilities.ts +106 -0
- package/src/client/client.ts +1809 -0
- package/src/client/commands.ts +193 -0
- package/src/client/crypto/crypt-ops.ts +6 -0
- package/src/client/crypto/crypt.ts +275 -0
- package/src/client/crypto/eax.ts +152 -0
- package/src/client/crypto/identity.ts +484 -0
- package/src/client/crypto/index.ts +21 -0
- package/src/client/crypto/primitives.ts +141 -0
- package/src/client/diagnostics.ts +58 -0
- package/src/client/discovery/index.ts +1 -0
- package/src/client/discovery/resolver.ts +325 -0
- package/src/client/errors.ts +217 -0
- package/src/client/events.ts +12 -0
- package/src/client/handshake/crypt-handshake.ts +157 -0
- package/src/client/handshake/crypt-init2.ts +48 -0
- package/src/client/handshake/index.ts +3 -0
- package/src/client/handshake/license.ts +208 -0
- package/src/client/handshake.ts +150 -0
- package/src/client/helpers.ts +10 -0
- package/src/client/hooks.ts +30 -0
- package/src/client/index.ts +93 -0
- package/src/client/reconnect.ts +43 -0
- package/src/client/throttle.ts +92 -0
- package/src/client/trace.ts +237 -0
- package/src/client/transfer.ts +436 -0
- package/src/client/transport/generation-window.ts +108 -0
- package/src/client/transport/handler.ts +926 -0
- package/src/client/transport/index.ts +14 -0
- package/src/client/transport/packet.ts +69 -0
- package/src/client/transport/quicklz.ts +209 -0
- package/src/client/types.ts +268 -0
- package/src/core/api/channels.ts +396 -0
- package/src/core/api/clients.ts +654 -0
- package/src/core/api/command.ts +563 -0
- package/src/core/api/files.ts +405 -0
- package/src/core/api/groups.ts +622 -0
- package/src/core/api/moderation.ts +525 -0
- package/src/core/api/parse.ts +52 -0
- package/src/core/api/server.ts +709 -0
- package/src/core/command/command.ts +125 -0
- package/src/core/command/ids.ts +149 -0
- package/src/core/command/parser.ts +68 -0
- package/src/core/command/request.ts +119 -0
- package/src/core/command/responses.ts +114 -0
- package/src/core/command-name.ts +334 -0
- package/src/core/enums.ts +167 -0
- package/src/core/errorcode.ts +412 -0
- package/src/core/errors.ts +258 -0
- package/src/core/events.ts +219 -0
- package/src/core/helpers.ts +161 -0
- package/src/core/index.ts +126 -0
- package/src/core/internal.ts +23 -0
- package/src/core/middleware.ts +24 -0
- package/src/core/notification-name.ts +155 -0
- package/src/core/notifications.ts +157 -0
- package/src/core/permission-name.ts +538 -0
- package/src/core/permission.ts +34 -0
- package/src/core/property-name.ts +411 -0
- package/src/core/reason.ts +38 -0
- package/src/core/reconnect.ts +98 -0
- package/src/core/types.ts +138 -0
- package/src/query/client.ts +1132 -0
- package/src/query/errors.ts +108 -0
- package/src/query/index.ts +65 -0
- package/src/query/knownhosts.ts +257 -0
- package/src/query/lines.ts +28 -0
- package/src/query/options.ts +388 -0
- package/src/query/reconnect.ts +84 -0
- package/src/query/ssh.ts +614 -0
- package/src/query/stream.ts +91 -0
- package/src/query/tcp.ts +85 -0
- package/src/query/transport.ts +35 -0
- package/src/query/web.ts +195 -0
- package/src/versions/index.ts +10774 -0
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Channel commands.
|
|
3
|
+
*
|
|
4
|
+
* Channel settings are a wide, mostly-optional set. The options objects name
|
|
5
|
+
* them in camelCase without the `channel_` prefix (`codecQuality` for
|
|
6
|
+
* `channel_codec_quality`), and each options type has a table naming every
|
|
7
|
+
* field's wire parameter, so the mapping is written down once and a key the
|
|
8
|
+
* table does not know is never sent.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
nonZero,
|
|
13
|
+
firstRow,
|
|
14
|
+
exec,
|
|
15
|
+
query,
|
|
16
|
+
list,
|
|
17
|
+
parseChannel,
|
|
18
|
+
parsePermission,
|
|
19
|
+
permissionParam,
|
|
20
|
+
encodeFields,
|
|
21
|
+
inSeconds,
|
|
22
|
+
big,
|
|
23
|
+
str,
|
|
24
|
+
} from "./command.js";
|
|
25
|
+
import type { Channel, PermissionEntry, WireNames } from "./command.js";
|
|
26
|
+
import type { CommandExecutor, CommandOptions } from "../command/request.js";
|
|
27
|
+
import type { ChannelID, ClientDBID } from "../command/ids.js";
|
|
28
|
+
import { asChannelID } from "../command/ids.js";
|
|
29
|
+
import { ErrorCode } from "../errorcode.js";
|
|
30
|
+
import type { Codec } from "../enums.js";
|
|
31
|
+
import type { Permission } from "../permission.js";
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Channel settings, as `channelcreate` and `channeledit` take them.
|
|
35
|
+
*
|
|
36
|
+
* Only the fields you set are sent. An unset (undefined) field is omitted and
|
|
37
|
+
* leaves the setting alone; any other value is sent, so `""` sends an empty
|
|
38
|
+
* value — `password: ""` clears a channel's password, while leaving `password`
|
|
39
|
+
* unset keeps it.
|
|
40
|
+
*/
|
|
41
|
+
export interface ChannelSettings {
|
|
42
|
+
/** The topic shown under the name (`channel_topic`). */
|
|
43
|
+
readonly topic?: string | undefined;
|
|
44
|
+
/** The description (`channel_description`). */
|
|
45
|
+
readonly description?: string | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* The channel password (`channel_password`), in cleartext: the voice client
|
|
48
|
+
* hashes it on the wire and ServerQuery sends it as is. `""` removes it.
|
|
49
|
+
*/
|
|
50
|
+
readonly password?: string | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Whether the channel is password-protected (`channel_flag_password`). The
|
|
53
|
+
* server sets this itself when a password is set.
|
|
54
|
+
*/
|
|
55
|
+
readonly hasPassword?: boolean | undefined;
|
|
56
|
+
/** The voice codec (`channel_codec`). */
|
|
57
|
+
readonly codec?: Codec | undefined;
|
|
58
|
+
/** The codec's quality, 0 to 10 (`channel_codec_quality`). */
|
|
59
|
+
readonly codecQuality?: number | undefined;
|
|
60
|
+
/** How many packets of voice to send at once, 1 to 10 (`channel_codec_latency_factor`). */
|
|
61
|
+
readonly codecLatencyFactor?: number | undefined;
|
|
62
|
+
/** Whether voice in the channel travels unencrypted (`channel_codec_is_unencrypted`). */
|
|
63
|
+
readonly isUnencrypted?: boolean | undefined;
|
|
64
|
+
/** How many clients may be in the channel (`channel_maxclients`). */
|
|
65
|
+
readonly maxClients?: number | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* How many clients may be in the channel and those under it
|
|
68
|
+
* (`channel_maxfamilyclients`).
|
|
69
|
+
*/
|
|
70
|
+
readonly maxFamilyClients?: number | undefined;
|
|
71
|
+
/** Whether `maxClients` is ignored (`channel_flag_maxclients_unlimited`). */
|
|
72
|
+
readonly isMaxClientsUnlimited?: boolean | undefined;
|
|
73
|
+
/** Whether `maxFamilyClients` is ignored (`channel_flag_maxfamilyclients_unlimited`). */
|
|
74
|
+
readonly isMaxFamilyClientsUnlimited?: boolean | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* Whether the family limit is taken from the parent
|
|
77
|
+
* (`channel_flag_maxfamilyclients_inherited`).
|
|
78
|
+
*/
|
|
79
|
+
readonly isMaxFamilyClientsInherited?: boolean | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* The channel to sort this one after among its siblings; 0 sorts it first
|
|
82
|
+
* (`channel_order`).
|
|
83
|
+
*/
|
|
84
|
+
readonly order?: ChannelID | undefined;
|
|
85
|
+
/** The talk power a client needs to speak here (`channel_needed_talk_power`). */
|
|
86
|
+
readonly neededTalkPower?: number | undefined;
|
|
87
|
+
/** Whether the channel survives a server restart (`channel_flag_permanent`). */
|
|
88
|
+
readonly isPermanent?: boolean | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* Whether the channel survives its last client leaving, but not a restart
|
|
91
|
+
* (`channel_flag_semi_permanent`).
|
|
92
|
+
*/
|
|
93
|
+
readonly isSemiPermanent?: boolean | undefined;
|
|
94
|
+
/** Whether new clients land here (`channel_flag_default`). */
|
|
95
|
+
readonly isDefault?: boolean | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* How long a temporary channel survives its last client leaving, in
|
|
98
|
+
* milliseconds (`channel_delete_delay`). Sent in whole seconds.
|
|
99
|
+
*/
|
|
100
|
+
readonly deleteDelayMs?: number | undefined;
|
|
101
|
+
/** How the name is pronounced, for text-to-speech (`channel_name_phonetic`). */
|
|
102
|
+
readonly namePhonetic?: string | undefined;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const settingNames: WireNames<ChannelSettings> = {
|
|
106
|
+
topic: "channel_topic",
|
|
107
|
+
description: "channel_description",
|
|
108
|
+
password: "channel_password",
|
|
109
|
+
hasPassword: "channel_flag_password",
|
|
110
|
+
codec: "channel_codec",
|
|
111
|
+
codecQuality: "channel_codec_quality",
|
|
112
|
+
codecLatencyFactor: "channel_codec_latency_factor",
|
|
113
|
+
isUnencrypted: "channel_codec_is_unencrypted",
|
|
114
|
+
maxClients: "channel_maxclients",
|
|
115
|
+
maxFamilyClients: "channel_maxfamilyclients",
|
|
116
|
+
isMaxClientsUnlimited: "channel_flag_maxclients_unlimited",
|
|
117
|
+
isMaxFamilyClientsUnlimited: "channel_flag_maxfamilyclients_unlimited",
|
|
118
|
+
isMaxFamilyClientsInherited: "channel_flag_maxfamilyclients_inherited",
|
|
119
|
+
order: "channel_order",
|
|
120
|
+
neededTalkPower: "channel_needed_talk_power",
|
|
121
|
+
isPermanent: "channel_flag_permanent",
|
|
122
|
+
isSemiPermanent: "channel_flag_semi_permanent",
|
|
123
|
+
isDefault: "channel_flag_default",
|
|
124
|
+
deleteDelayMs: ["channel_delete_delay", inSeconds],
|
|
125
|
+
namePhonetic: "channel_name_phonetic",
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
/** A new channel's settings. Only `name` is required; see {@link ChannelSettings}. */
|
|
129
|
+
export interface ChannelCreateOptions extends ChannelSettings {
|
|
130
|
+
/** The channel's name (`channel_name`). */
|
|
131
|
+
readonly name: string;
|
|
132
|
+
/**
|
|
133
|
+
* The channel to create the new one under; unset or 0 is the top level, and
|
|
134
|
+
* either omits the parameter (`cpid`).
|
|
135
|
+
*/
|
|
136
|
+
readonly parentID?: ChannelID | undefined;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const createNames: WireNames<ChannelCreateOptions> = {
|
|
140
|
+
name: "channel_name",
|
|
141
|
+
parentID: ["cpid", nonZero],
|
|
142
|
+
...settingNames,
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Create a channel and return the id the server assigned.
|
|
147
|
+
*
|
|
148
|
+
* Over the voice protocol the server also moves the creator into the new
|
|
149
|
+
* channel.
|
|
150
|
+
*
|
|
151
|
+
* `channel` is what to send; the command's `signal` and `timeoutMs` go in
|
|
152
|
+
* `options`, a separate last argument — set among the fields, they are not
|
|
153
|
+
* read.
|
|
154
|
+
*/
|
|
155
|
+
export async function createChannel(
|
|
156
|
+
client: CommandExecutor,
|
|
157
|
+
channel: ChannelCreateOptions,
|
|
158
|
+
options?: CommandOptions,
|
|
159
|
+
): Promise<ChannelID> {
|
|
160
|
+
const rows = await query(client, "channelcreate", encodeFields(channel, createNames), options, [
|
|
161
|
+
"channel_password",
|
|
162
|
+
]);
|
|
163
|
+
return asChannelID(big(firstRow(rows, "channelcreate", "cid"), "cid"));
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** A channel's changed settings; see {@link ChannelSettings}. */
|
|
167
|
+
export interface ChannelEditOptions extends ChannelSettings {
|
|
168
|
+
/** The channel's new name (`channel_name`). */
|
|
169
|
+
readonly name?: string | undefined;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const editNames: WireNames<ChannelEditOptions> = { name: "channel_name", ...settingNames };
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Change a channel's settings. Only the fields you set are sent.
|
|
176
|
+
*
|
|
177
|
+
* `settings` is what to send; the command's `signal` and `timeoutMs` go in
|
|
178
|
+
* `options`, a separate last argument — set among the fields, they are not
|
|
179
|
+
* read.
|
|
180
|
+
*/
|
|
181
|
+
export async function editChannel(
|
|
182
|
+
client: CommandExecutor,
|
|
183
|
+
cid: ChannelID,
|
|
184
|
+
settings: ChannelEditOptions,
|
|
185
|
+
options?: CommandOptions,
|
|
186
|
+
): Promise<void> {
|
|
187
|
+
await exec(client, "channeledit", [["cid", cid], ...encodeFields(settings, editNames)], options, [
|
|
188
|
+
"channel_password",
|
|
189
|
+
]);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/** How {@link deleteChannel} deletes. */
|
|
193
|
+
export interface ChannelDeleteOptions extends CommandOptions {
|
|
194
|
+
/**
|
|
195
|
+
* Delete the channel even while clients are in it, moving them out; false
|
|
196
|
+
* by default, which the server then refuses for an occupied channel
|
|
197
|
+
* (`force`, always sent).
|
|
198
|
+
*/
|
|
199
|
+
readonly force?: boolean | undefined;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/** Delete a channel. */
|
|
203
|
+
export async function deleteChannel(
|
|
204
|
+
client: CommandExecutor,
|
|
205
|
+
cid: ChannelID,
|
|
206
|
+
options: ChannelDeleteOptions = {},
|
|
207
|
+
): Promise<void> {
|
|
208
|
+
await exec(
|
|
209
|
+
client,
|
|
210
|
+
"channeldelete",
|
|
211
|
+
[
|
|
212
|
+
["cid", cid],
|
|
213
|
+
["force", options.force ?? false],
|
|
214
|
+
],
|
|
215
|
+
options,
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const listFlags: ReadonlyArray<readonly [string, true]> = [
|
|
220
|
+
["-topic", true],
|
|
221
|
+
["-flags", true],
|
|
222
|
+
["-voice", true],
|
|
223
|
+
["-limits", true],
|
|
224
|
+
["-icon", true],
|
|
225
|
+
];
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* All channels on the server, in the server's own sort order.
|
|
229
|
+
*
|
|
230
|
+
* Always asks for the topic, flags, voice, limits and icon, which a bare
|
|
231
|
+
* `channellist` leaves out. `description` and `uid` are not part of
|
|
232
|
+
* `channellist` and stay empty; `getChannelInfo` has them.
|
|
233
|
+
*/
|
|
234
|
+
export async function listChannels(
|
|
235
|
+
client: CommandExecutor,
|
|
236
|
+
options?: CommandOptions,
|
|
237
|
+
): Promise<Channel[]> {
|
|
238
|
+
return (await list(client, "channellist", listFlags, options)).map(parseChannel);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* One channel's full settings.
|
|
243
|
+
*
|
|
244
|
+
* `totalClients`, `totalFamilyClients` and `neededSubscribePower` are left
|
|
245
|
+
* undefined: `channelinfo` does not carry them. `listChannels` does.
|
|
246
|
+
*
|
|
247
|
+
* `channelinfo` answers with `pid` and the settings but no `cid` — the channel
|
|
248
|
+
* is whatever was asked for — so the id is taken from the argument rather than
|
|
249
|
+
* read from the row, where it would come back 0.
|
|
250
|
+
*/
|
|
251
|
+
export async function getChannelInfo(
|
|
252
|
+
client: CommandExecutor,
|
|
253
|
+
cid: ChannelID,
|
|
254
|
+
options?: CommandOptions,
|
|
255
|
+
): Promise<Channel> {
|
|
256
|
+
const rows = await query(client, "channelinfo", [["cid", cid]], options);
|
|
257
|
+
return { ...parseChannel(firstRow(rows, "channelinfo")), id: cid };
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/** A channel whose name matched a search. */
|
|
261
|
+
export interface ChannelMatch {
|
|
262
|
+
/** The channel's id. */
|
|
263
|
+
readonly id: ChannelID;
|
|
264
|
+
/** The channel's name. */
|
|
265
|
+
readonly name: string;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Channels whose name contains `pattern`; none is an empty list. The server
|
|
270
|
+
* reports finding none as error 768 (invalid channelID), which this answers
|
|
271
|
+
* as `[]`.
|
|
272
|
+
*/
|
|
273
|
+
export async function findChannels(
|
|
274
|
+
client: CommandExecutor,
|
|
275
|
+
pattern: string,
|
|
276
|
+
options?: CommandOptions,
|
|
277
|
+
): Promise<ChannelMatch[]> {
|
|
278
|
+
const rows = await list(client, "channelfind", [["pattern", pattern]], options, {
|
|
279
|
+
noMatch: ErrorCode.ChannelInvalidID,
|
|
280
|
+
});
|
|
281
|
+
return rows.map((row) => ({ id: asChannelID(big(row, "cid")), name: str(row, "channel_name") }));
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/** Where {@link moveChannel} sorts the channel among its new siblings. */
|
|
285
|
+
export interface ChannelMoveOptions extends CommandOptions {
|
|
286
|
+
/** The sibling to sort after, 0 for first; unset leaves it to the server (`order`). */
|
|
287
|
+
readonly order?: ChannelID | undefined;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/** Move a channel under a new parent. */
|
|
291
|
+
export async function moveChannel(
|
|
292
|
+
client: CommandExecutor,
|
|
293
|
+
cid: ChannelID,
|
|
294
|
+
parentID: ChannelID,
|
|
295
|
+
options: ChannelMoveOptions = {},
|
|
296
|
+
): Promise<void> {
|
|
297
|
+
await exec(
|
|
298
|
+
client,
|
|
299
|
+
"channelmove",
|
|
300
|
+
[
|
|
301
|
+
["cid", cid],
|
|
302
|
+
["cpid", parentID],
|
|
303
|
+
["order", options.order],
|
|
304
|
+
],
|
|
305
|
+
options,
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// ---- Channel permissions ----------------------------------------------------
|
|
310
|
+
|
|
311
|
+
/** Set a permission on a channel. */
|
|
312
|
+
export async function addChannelPermission(
|
|
313
|
+
client: CommandExecutor,
|
|
314
|
+
cid: ChannelID,
|
|
315
|
+
permission: Permission,
|
|
316
|
+
value: number,
|
|
317
|
+
options?: CommandOptions,
|
|
318
|
+
): Promise<void> {
|
|
319
|
+
await exec(
|
|
320
|
+
client,
|
|
321
|
+
"channeladdperm",
|
|
322
|
+
[["cid", cid], permissionParam(permission), ["permvalue", value]],
|
|
323
|
+
options,
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/** Remove a permission from a channel. */
|
|
328
|
+
export async function deleteChannelPermission(
|
|
329
|
+
client: CommandExecutor,
|
|
330
|
+
cid: ChannelID,
|
|
331
|
+
permission: Permission,
|
|
332
|
+
options?: CommandOptions,
|
|
333
|
+
): Promise<void> {
|
|
334
|
+
await exec(client, "channeldelperm", [["cid", cid], permissionParam(permission)], options);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/** Permissions set directly on a channel. */
|
|
338
|
+
export async function listChannelPermissions(
|
|
339
|
+
client: CommandExecutor,
|
|
340
|
+
cid: ChannelID,
|
|
341
|
+
options?: CommandOptions,
|
|
342
|
+
): Promise<PermissionEntry[]> {
|
|
343
|
+
return (await list(client, "channelpermlist", [["cid", cid]], options)).map(parsePermission);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/** Permissions granted to one client within one channel. */
|
|
347
|
+
export async function listChannelClientPermissions(
|
|
348
|
+
client: CommandExecutor,
|
|
349
|
+
cid: ChannelID,
|
|
350
|
+
cldbid: ClientDBID,
|
|
351
|
+
options?: CommandOptions,
|
|
352
|
+
): Promise<PermissionEntry[]> {
|
|
353
|
+
const rows = await list(
|
|
354
|
+
client,
|
|
355
|
+
"channelclientpermlist",
|
|
356
|
+
[
|
|
357
|
+
["cid", cid],
|
|
358
|
+
["cldbid", cldbid],
|
|
359
|
+
],
|
|
360
|
+
options,
|
|
361
|
+
);
|
|
362
|
+
return rows.map(parsePermission);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/** Set a permission on one client within one channel. */
|
|
366
|
+
export async function addChannelClientPermission(
|
|
367
|
+
client: CommandExecutor,
|
|
368
|
+
cid: ChannelID,
|
|
369
|
+
cldbid: ClientDBID,
|
|
370
|
+
permission: Permission,
|
|
371
|
+
value: number,
|
|
372
|
+
options?: CommandOptions,
|
|
373
|
+
): Promise<void> {
|
|
374
|
+
await exec(
|
|
375
|
+
client,
|
|
376
|
+
"channelclientaddperm",
|
|
377
|
+
[["cid", cid], ["cldbid", cldbid], permissionParam(permission), ["permvalue", value]],
|
|
378
|
+
options,
|
|
379
|
+
);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/** Remove a permission from one client within one channel. */
|
|
383
|
+
export async function deleteChannelClientPermission(
|
|
384
|
+
client: CommandExecutor,
|
|
385
|
+
cid: ChannelID,
|
|
386
|
+
cldbid: ClientDBID,
|
|
387
|
+
permission: Permission,
|
|
388
|
+
options?: CommandOptions,
|
|
389
|
+
): Promise<void> {
|
|
390
|
+
await exec(
|
|
391
|
+
client,
|
|
392
|
+
"channelclientdelperm",
|
|
393
|
+
[["cid", cid], ["cldbid", cldbid], permissionParam(permission)],
|
|
394
|
+
options,
|
|
395
|
+
);
|
|
396
|
+
}
|