-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathlegacy.d.ts
230 lines (197 loc) · 6.37 KB
/
legacy.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
import { Fiber } from "react-reconciler";
import { Cancel } from ".";
import { ModuleFilter } from "./webpack";
import {
CloseNotice,
ConfirmationModalOptions,
DialogOpenOptions,
DialogOpenResult,
DialogSaveOptions,
DialogSaveResult,
NoticeOptions,
ToastOptions,
} from "./ui";
/** @deprecated */
export interface Legacy {
/**
* BetterDiscord's emotes.
* @deprecated
*/
emotes: any;
/**
* BetterDiscord's settings.
* @deprecated
*/
settings: any;
/**
* Shows a generic but customizable modal.
* @deprecated Use {@link BdApi.UI.alert} instead.
*/
alert(title: string, children: React.ReactNode): void;
/**
* Shows a generic but customizable confirmation modal with optional confirm and cancel callbacks.
* @deprecated Use {@link BdApi.UI.showConfirmationModal} instead.
*/
showConfirmationModal(
title: string,
content: React.ReactNode,
options?: ConfirmationModalOptions,
): void;
/**
* Shows a notice above Discord's chat layer. Returns a callback for closing the notice.
* @deprecated Use {@link BdApi.UI.showNotice} instead.
*/
showNotice(content: string | Node, options?: NoticeOptions): CloseNotice;
/**
* Shows a toast towards the bottom of the screen.
* @deprecated Use {@link BdApi.UI.showToast} instead.
*/
showToast(content: string, options?: ToastOptions): void;
/**
* Opens an Electron dialog.
* @deprecated Use {@link BdApi.UI.openDialog} instead.
*/
openDialog(options: DialogSaveOptions): Promise<DialogSaveResult>;
openDialog(options: DialogOpenOptions): Promise<DialogOpenResult>;
/**
* Loads previously stored data.
* @deprecated Use {@link BdApi.Data.load} instead.
*/
loadData(pluginName: string, key: string): any;
/**
* Saves JSON-serializable data.
* @deprecated Use {@link BdApi.Data.save} instead.
*/
saveData(pluginName: string, key: string, data: any): void;
/**
* Deletes a piece of stored data. This is different than saving `null` or `undefined`.
* @deprecated Use {@link BdApi.Data.delete} instead.
*/
deleteData(pluginName: string, key: string): void;
/**
* Adds a `<style>` to the document with the given ID.
* @deprecated Use {@link BdApi.DOM.addStyle} instead.
*/
injectCSS(id: string, styles: string): void;
/**
* Removes a `<style>` from the document corresponding to the given ID.
* @deprecated Use {@link BdApi.DOM.removeStyle} instead.
*/
clearCSS(id: string): void;
/**
* Adds a listener for when the node is removed from the document body.
* @deprecated Use {@link BdApi.DOM.onRemoved} instead.
*/
onRemoved(node: HTMLElement, callback: () => void): void;
/**
* Returns the internal React data (fiber) of a specific node.
* @deprecated Use {@link BdApi.ReactUtils.getInternalInstance} instead.
*/
getInternalInstance(node: HTMLElement): Fiber | undefined;
/**
* Returns whether a specific BetterDiscord settings is currently enabled.
* @deprecated
*/
isSettingEnabled(collection: string, category: string, id: string): boolean;
isSettingEnabled(category: string, id: string): boolean;
/**
* Enables a BetterDiscord setting by ID.
* @deprecated
*/
enableSetting(collection: string, category: string, id: string): void;
enableSetting(category: string, id: string): void;
/**
* Disables a BetterDiscord setting by ID.
* @deprecated
*/
enableSetting(collection: string, category: string, id: string): void;
enableSetting(category: string, id: string): void;
/**
* Toggles a BetterDiscord setting by ID.
* @deprecated
*/
toggleSetting(collection: string, category: string, id: string): void;
toggleSetting(category: string, id: string): void;
/**
* Gets some data in BetterDiscord's misc data.
* @deprecated
*/
getBDData(key: string): any;
/**
* Sets some data in BetterDiscord's misc data.
* @deprecated
*/
setBDData(key: string, data: any): void;
/**
* Creates and links a remote JS script.
* @deprecated Using remote scripts is highly discouraged.
*/
linkJS(id: string, url: string): Promise<void>;
/**
* Removes a remotely linked JS script.
* @deprecated Using remote scripts is highly discouraged.
*/
unlinkJS(id: string): void;
/**
* Monkey-patches a method on an object.
* The patching callback may be run before, after or instead of target method.
* @deprecated Use {@link BdApi.Patcher} instead.
*/
monkeyPatch<M>(
what: M,
methodName: keyof M,
options: MonkeyPatchOptions,
): Cancel;
/**
* Finds a webpack module matching the filter.
* @deprecated Use {@link BdApi.Webpack} instead.
*/
findModule(filter: ModuleFilter): any | undefined;
/**
* Finds all webpack modules matching the filter.
* @deprecated Use {@link BdApi.Webpack} instead.
*/
findAllModules(filter: ModuleFilter): any[];
/**
* Finds a webpack module by its `displayName` property.
* @deprecated Use {@link BdApi.Webpack} instead.
*/
findModuleByDisplayName(name: string): any | undefined;
/**
* Finds a webpack module by its property names.
* @deprecated Use {@link BdApi.Webpack} instead.
*/
findModuleByProps(...props: string[]): any | undefined;
/**
* Finds a webpack module by properties of its prototype.
* @deprecated Use {@link BdApi.Webpack} instead.
*/
findModuleByPrototypes(...protos: string[]): any | undefined;
/**
* Wraps a given function in a `try..catch` block.
* @deprecated
*/
suppressErrors<F extends (...args: any) => any>(
method: F,
message: string,
): F;
/**
* Tests a given object to determine if it is valid JSON.
* @deprecated
*/
testJSON(data: any): boolean;
}
/** @deprecated */
export interface MonkeyPatchOptions {
after?: (data: MonkeyPatchData) => any;
before?: (data: MonkeyPatchData) => any;
instead?: (data: MonkeyPatchData) => any;
once?: boolean;
silent?: boolean;
}
/** @deprecated */
export interface MonkeyPatchData {
thisObject: any;
methodArguments: IArguments;
returnValue: any;
}