-
Notifications
You must be signed in to change notification settings - Fork 48
/
index.d.ts
105 lines (99 loc) · 3.09 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/// <reference types="node" />
export interface InputStream extends NodeJS.WritableStream {
close: () => void;
setGain: (gain: number) => void;
connection: Connection;
channels: number;
whisperId: number;
sampleRate: number;
gain: number;
bitDepth: number;
signed: boolean;
endianness: "BE" | "LE";
processInterval: NodeJS.Timer;
processObserver: NodeJS.EventEmitter;
frameQueue: Buffer[];
lastFrame: Buffer;
lastFrameWritten: number;
queuedForPlay: number;
lastWrite: number;
sent: number;
}
export interface OutputStream extends NodeJS.ReadableStream {
close: () => void;
connection: Connection;
sessionId: number;
eventEmitter: NodeJS.EventEmitter;
frames: Buffer[];
writtenUntil: number;
noEmptyFrames: boolean;
emptyFrame: Buffer;
voiceListener: (data: Buffer) => void;
}
export interface Channel {
addSubChannel: (name: string, options: any) => void;
getPermissions: (callback: () => any) => void;
join: () => void;
remove: () => void;
sendMessage: (message: string) => void;
children: Channel[];
links: Channel[];
users: User[];
name: string;
id: number;
position: number;
}
export interface User {
channel: Channel;
deaf: boolean;
hash: string;
id: number;
mute: boolean;
name: string;
prioritySpeaker: boolean;
recording: boolean;
selfDeaf: boolean;
selfMute: boolean;
session: number;
suppress: boolean;
ban: (reason?: string) => void;
canHear: () => boolean;
canTalk: () => boolean;
inputStream: () => InputStream;
isRegistered: () => boolean;
kick: (reason?: string) => void;
moveToChannel: (channel: Channel) => void;
outputStream: (noEmptyFrames?: boolean) => OutputStream;
sendMessage: (message: string) => void;
setComment: (comment: string) => void;
setSelfDeaf: (isSelfDeaf: boolean) => void;
setSelfMute: (isSelfMute: boolean) => void;
on: (event: string, callback: (...args: any[]) => any) => void;
once: (event: string, callback: (...args: any[]) => any) => void;
register: () => void;
}
export interface Options {
key?: string;
cert?: string;
celtVersion?: string;
}
export interface Connection {
authenticate: (username: string, password: string) => void;
users: () => User[];
channelById: (id: number) => Channel;
userById: (id: number) => User;
channelByName: (name: string) => Channel;
userByName: (name: string) => User;
sendMessage: (name: string, data: string) => void;
outputStream: (userId?: number) => OutputStream;
inputStream: () => InputStream;
disconnect: () => void;
sendVoice: (chunk: Buffer) => void;
on: (event: string, callback: (...args: any[]) => any) => void;
once: (event: string, callback: (...args: any[]) => any) => void;
ready: boolean;
rootChannel: Channel;
user: User;
getRegisteredUsers: (callback: (registeredUsers: any[]) => void) => void;
}
export function connect(url: string, options: Options, callback: (err: Error, connection: Connection) => void): void;