seyfert 1.2.1 → 1.2.3
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 +190 -190
- package/README.md +46 -46
- package/lib/api/Router.d.ts +9 -0
- package/lib/api/Router.js +16 -8
- package/lib/api/Routes/cdn.d.ts +26 -15
- package/lib/api/api.d.ts +2 -3
- package/lib/api/api.js +4 -9
- package/lib/api/index.d.ts +0 -1
- package/lib/api/index.js +0 -1
- package/lib/builders/Modal.d.ts +4 -1
- package/lib/builders/Modal.js +4 -1
- package/lib/cache/adapters/default.d.ts +1 -0
- package/lib/cache/adapters/default.js +4 -0
- package/lib/cache/adapters/redis.d.ts +2 -0
- package/lib/cache/adapters/redis.js +17 -0
- package/lib/cache/adapters/types.d.ts +1 -0
- package/lib/cache/adapters/workeradapter.d.ts +1 -0
- package/lib/cache/adapters/workeradapter.js +6 -9
- package/lib/cache/index.d.ts +4 -6
- package/lib/cache/index.js +3 -0
- package/lib/cache/resources/overwrites.d.ts +2 -0
- package/lib/cache/resources/voice-states.d.ts +7 -2
- package/lib/cache/resources/voice-states.js +11 -0
- package/lib/client/base.d.ts +1 -1
- package/lib/client/base.js +8 -5
- package/lib/client/oninteractioncreate.js +7 -7
- package/lib/client/onmessagecreate.js +27 -15
- package/lib/client/workerclient.js +6 -12
- package/lib/commands/applications/chat.d.ts +20 -15
- package/lib/commands/applications/chat.js +13 -7
- package/lib/commands/applications/chatcontext.d.ts +2 -1
- package/lib/commands/applications/chatcontext.js +3 -0
- package/lib/commands/applications/menu.d.ts +4 -3
- package/lib/commands/applications/menu.js +9 -6
- package/lib/commands/applications/menucontext.d.ts +4 -1
- package/lib/commands/applications/menucontext.js +9 -0
- package/lib/commands/applications/shared.d.ts +4 -0
- package/lib/commands/applications/shared.js +6 -0
- package/lib/commands/basecontex.d.ts +1 -1
- package/lib/commands/basecontex.js +5 -11
- package/lib/commands/decorators.d.ts +14 -4
- package/lib/commands/decorators.js +29 -5
- package/lib/commands/handler.js +2 -0
- package/lib/common/shorters/channels.d.ts +12 -2
- package/lib/common/shorters/channels.js +16 -2
- package/lib/common/shorters/members.d.ts +6 -0
- package/lib/common/shorters/members.js +6 -0
- package/lib/common/shorters/messages.d.ts +2 -2
- package/lib/common/shorters/messages.js +7 -3
- package/lib/common/types/options.d.ts +2 -2
- package/lib/components/componentcontext.d.ts +1 -0
- package/lib/components/componentcontext.js +3 -0
- package/lib/structures/GuildEmoji.d.ts +2 -2
- package/lib/structures/GuildEmoji.js +1 -1
- package/lib/structures/GuildMember.d.ts +1 -5
- package/lib/structures/GuildMember.js +3 -3
- package/lib/structures/Message.d.ts +1 -1
- package/lib/structures/User.d.ts +2 -3
- package/lib/structures/User.js +9 -4
- package/lib/structures/VoiceState.d.ts +18 -0
- package/lib/structures/VoiceState.js +48 -0
- package/lib/structures/Webhook.js +1 -1
- package/lib/structures/channels.d.ts +11 -3
- package/lib/structures/channels.js +14 -1
- package/lib/structures/extra/BaseGuild.js +3 -3
- package/lib/structures/extra/Permissions.d.ts +1 -1
- package/lib/structures/index.d.ts +1 -0
- package/lib/structures/index.js +1 -0
- package/lib/websocket/discord/shard.d.ts +4 -4
- package/lib/websocket/discord/shard.js +12 -17
- package/lib/websocket/discord/sharder.d.ts +1 -1
- package/lib/websocket/discord/sharder.js +2 -2
- package/lib/websocket/discord/worker.d.ts +1 -1
- package/lib/websocket/discord/workermanager.js +4 -10
- package/lib/websocket/structures/index.d.ts +6 -99
- package/lib/websocket/structures/index.js +29 -211
- package/lib/websocket/structures/timeout.d.ts +2 -2
- package/lib/websocket/structures/timeout.js +13 -16
- package/package.json +2 -2
- package/lib/api/CDN.d.ts +0 -212
- package/lib/api/CDN.js +0 -228
- package/lib/common/shorters/overwrites.d.ts +0 -29
- package/lib/common/shorters/overwrites.js +0 -63
- package/lib/components/listener.d.ts +0 -11
- package/lib/components/listener.js +0 -17
- package/lib/structures/extra/BaseComponent.d.ts +0 -9
- package/lib/structures/extra/BaseComponent.js +0 -12
- package/lib/structures/extra/BaseSelectMenuComponent.d.ts +0 -9
- package/lib/structures/extra/BaseSelectMenuComponent.js +0 -13
|
@@ -1,256 +1,74 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.DynamicBucket = void 0;
|
|
4
4
|
const common_1 = require("../../common");
|
|
5
|
-
/**
|
|
6
|
-
* generally useless for interaction based bots
|
|
7
|
-
* ideally this would only be triggered on certain paths
|
|
8
|
-
* example: a huge amount of messages being spammed
|
|
9
|
-
*
|
|
10
|
-
* a dynamic bucket is just a priority queue implemented using linked lists
|
|
11
|
-
* we create an empty bucket for every path
|
|
12
|
-
* dynamically allocating memory improves the final memory footprint
|
|
13
|
-
*/
|
|
14
5
|
class DynamicBucket {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
refillAmount;
|
|
18
|
-
/** The queue of requests to acquire an available request. Mapped by <shardId, resolve()> */
|
|
19
|
-
queue = new PriorityQueue();
|
|
20
|
-
/** The amount of requests that have been used up already. */
|
|
6
|
+
options;
|
|
7
|
+
queue = [];
|
|
21
8
|
used = 0;
|
|
22
|
-
|
|
23
|
-
processing = false;
|
|
24
|
-
/** The timeout id for the timer to reduce the used amount by the refill amount. */
|
|
25
|
-
timeoutId;
|
|
26
|
-
/** The timestamp in milliseconds when the next refill is scheduled. */
|
|
9
|
+
processing;
|
|
27
10
|
refillsAt;
|
|
28
|
-
|
|
11
|
+
timeoutId;
|
|
29
12
|
constructor(options) {
|
|
30
|
-
this.
|
|
31
|
-
this.refillInterval = options.refillInterval;
|
|
32
|
-
this.refillAmount = options.refillAmount;
|
|
33
|
-
if (options.debugger) {
|
|
34
|
-
this.debugger = options.debugger;
|
|
35
|
-
}
|
|
13
|
+
this.options = options;
|
|
36
14
|
}
|
|
37
15
|
get remaining() {
|
|
38
|
-
if (this.limit < this.used) {
|
|
16
|
+
if (this.options.limit < this.used) {
|
|
39
17
|
return 0;
|
|
40
18
|
}
|
|
41
|
-
return this.limit - this.used;
|
|
19
|
+
return this.options.limit - this.used;
|
|
42
20
|
}
|
|
43
21
|
refill() {
|
|
44
|
-
// Lower the used amount by the refill amount
|
|
45
|
-
this.used = this.refillAmount > this.used ? 0 : this.used - this.refillAmount;
|
|
46
|
-
// Reset the refillsAt timestamp since it just got refilled
|
|
47
22
|
this.refillsAt = undefined;
|
|
23
|
+
if (this.timeoutId) {
|
|
24
|
+
clearTimeout(this.timeoutId);
|
|
25
|
+
this.timeoutId = undefined;
|
|
26
|
+
}
|
|
48
27
|
if (this.used > 0) {
|
|
49
|
-
|
|
50
|
-
clearTimeout(this.timeoutId);
|
|
51
|
-
}
|
|
28
|
+
this.used = 0;
|
|
52
29
|
this.timeoutId = setTimeout(() => {
|
|
53
30
|
this.refill();
|
|
54
|
-
}, this.refillInterval);
|
|
55
|
-
this.refillsAt = Date.now() + this.refillInterval;
|
|
31
|
+
}, this.options.refillInterval);
|
|
32
|
+
this.refillsAt = Date.now() + this.options.refillInterval;
|
|
56
33
|
}
|
|
57
34
|
}
|
|
58
|
-
/** Begin processing the queue. */
|
|
59
35
|
async processQueue() {
|
|
60
|
-
|
|
61
|
-
if (this.processing) {
|
|
36
|
+
if (this.processing)
|
|
62
37
|
return;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
while (!this.queue.isEmpty()) {
|
|
38
|
+
this.processing = true;
|
|
39
|
+
while (this.queue.length) {
|
|
66
40
|
if (this.remaining) {
|
|
67
|
-
this.debugger?.debug(`Processing queue. Remaining: ${this.remaining} Length: ${this.queue.
|
|
68
|
-
|
|
69
|
-
this.queue.peek()();
|
|
70
|
-
this.queue.pop();
|
|
71
|
-
// A request can be made
|
|
41
|
+
this.options.debugger?.debug(`Processing queue. Remaining: ${this.remaining} Length: ${this.queue.length}`);
|
|
42
|
+
this.queue.shift()();
|
|
72
43
|
this.used++;
|
|
73
|
-
// Create a new timeout for this request if none exists.
|
|
74
44
|
if (!this.timeoutId) {
|
|
75
45
|
this.timeoutId = setTimeout(() => {
|
|
76
46
|
this.refill();
|
|
77
|
-
}, this.refillInterval);
|
|
78
|
-
|
|
79
|
-
this.refillsAt = Date.now() + this.refillInterval;
|
|
47
|
+
}, this.options.refillInterval);
|
|
48
|
+
this.refillsAt = Date.now() + this.options.refillInterval;
|
|
80
49
|
}
|
|
81
|
-
// Check if a refill is scheduled, since we have used up all available requests
|
|
82
50
|
}
|
|
83
51
|
else if (this.refillsAt) {
|
|
84
52
|
const now = Date.now();
|
|
85
|
-
// If there is time left until next refill, just delay execution.
|
|
86
53
|
if (this.refillsAt > now) {
|
|
54
|
+
this.options.debugger?.info(`Waiting ${this.refillsAt - now}ms to process queue`);
|
|
87
55
|
await (0, common_1.delay)(this.refillsAt - now);
|
|
56
|
+
this.used = 0;
|
|
88
57
|
}
|
|
89
58
|
}
|
|
90
59
|
}
|
|
91
|
-
// Loop has ended mark false so it can restart later when needed
|
|
92
60
|
this.processing = false;
|
|
93
61
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
this.queue.push(resolve, priority);
|
|
62
|
+
acquire(force = false) {
|
|
63
|
+
return new Promise(res => {
|
|
64
|
+
this.queue[force ? 'unshift' : 'push'](res);
|
|
98
65
|
void this.processQueue();
|
|
99
66
|
});
|
|
100
67
|
}
|
|
101
|
-
toString() {
|
|
102
|
-
return [...this.queue].toString();
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
exports.DynamicBucket = DynamicBucket;
|
|
106
|
-
class TNode {
|
|
107
|
-
data;
|
|
108
|
-
next;
|
|
109
|
-
constructor(data) {
|
|
110
|
-
this.data = data;
|
|
111
|
-
this.next = null;
|
|
112
|
-
}
|
|
113
|
-
static null(list) {
|
|
114
|
-
return !list;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
exports.TNode = TNode;
|
|
118
|
-
class PNode extends TNode {
|
|
119
|
-
priority;
|
|
120
|
-
constructor(data, priority) {
|
|
121
|
-
super(data);
|
|
122
|
-
this.priority = priority;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
exports.PNode = PNode;
|
|
126
|
-
class Queue {
|
|
127
|
-
/**
|
|
128
|
-
* O(1)
|
|
129
|
-
*/
|
|
130
|
-
pop() {
|
|
131
|
-
if (TNode.null(this.head)) {
|
|
132
|
-
throw new Error('cannot pop a list without elements');
|
|
133
|
-
}
|
|
134
|
-
return (this.head = this.head.next);
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* O(1)
|
|
138
|
-
*/
|
|
139
|
-
peek() {
|
|
140
|
-
if (TNode.null(this.head)) {
|
|
141
|
-
throw new Error('cannot peek an empty list');
|
|
142
|
-
}
|
|
143
|
-
return this.head.data;
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* O(n)
|
|
147
|
-
*/
|
|
148
|
-
size() {
|
|
149
|
-
let aux = this.head;
|
|
150
|
-
if (TNode.null(aux)) {
|
|
151
|
-
return 0;
|
|
152
|
-
}
|
|
153
|
-
let count = 1;
|
|
154
|
-
while (aux.next !== null) {
|
|
155
|
-
count++;
|
|
156
|
-
aux = aux.next;
|
|
157
|
-
}
|
|
158
|
-
return count;
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* O(1)
|
|
162
|
-
*/
|
|
163
|
-
isEmpty() {
|
|
164
|
-
return TNode.null(this.head);
|
|
165
|
-
}
|
|
166
|
-
*[Symbol.iterator]() {
|
|
167
|
-
let temp = this.head;
|
|
168
|
-
while (temp !== null) {
|
|
169
|
-
yield temp.data;
|
|
170
|
-
temp = temp.next;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
toArray() {
|
|
174
|
-
return Array.from(this);
|
|
175
|
-
}
|
|
176
|
-
toString() {
|
|
177
|
-
return this.head?.toString() || '';
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
exports.Queue = Queue;
|
|
181
|
-
class LinkedList extends Queue {
|
|
182
|
-
head = null;
|
|
183
|
-
/**
|
|
184
|
-
* O(1)
|
|
185
|
-
*/
|
|
186
|
-
push(data) {
|
|
187
|
-
const temp = new TNode(data);
|
|
188
|
-
temp.next = this.head;
|
|
189
|
-
this.head = temp;
|
|
190
|
-
return this.head;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
exports.LinkedList = LinkedList;
|
|
194
|
-
class PriorityQueue extends Queue {
|
|
195
|
-
head = null;
|
|
196
|
-
/**
|
|
197
|
-
* O(#priorities)
|
|
198
|
-
*/
|
|
199
|
-
push(data, priority) {
|
|
200
|
-
let start = this.head;
|
|
201
|
-
const temp = new PNode(data, priority);
|
|
202
|
-
if (TNode.null(this.head) || TNode.null(start)) {
|
|
203
|
-
this.head = temp;
|
|
204
|
-
return this.head;
|
|
205
|
-
}
|
|
206
|
-
if (this.head.priority > priority) {
|
|
207
|
-
temp.next = this.head;
|
|
208
|
-
this.head = temp;
|
|
209
|
-
return this.head;
|
|
210
|
-
}
|
|
211
|
-
while (start.next !== null && start.next.priority < priority) {
|
|
212
|
-
start = start.next;
|
|
213
|
-
}
|
|
214
|
-
temp.next = start.next;
|
|
215
|
-
start.next = temp;
|
|
216
|
-
return this.head;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
exports.PriorityQueue = PriorityQueue;
|
|
220
|
-
class SequentialBucket {
|
|
221
|
-
connections;
|
|
222
|
-
capacity; // max_concurrency
|
|
223
|
-
spawnTimeout;
|
|
224
|
-
constructor(maxCapacity) {
|
|
225
|
-
this.connections = new LinkedList();
|
|
226
|
-
this.capacity = maxCapacity;
|
|
227
|
-
this.spawnTimeout = 5000;
|
|
228
|
-
}
|
|
229
|
-
async destroy() {
|
|
230
|
-
this.connections = new LinkedList();
|
|
231
|
-
}
|
|
232
|
-
async push(promise) {
|
|
233
|
-
this.connections.push(promise);
|
|
234
|
-
if (this.capacity <= this.connections.size()) {
|
|
235
|
-
await this.acquire();
|
|
236
|
-
await (0, common_1.delay)(this.spawnTimeout);
|
|
237
|
-
}
|
|
238
|
-
return;
|
|
239
|
-
}
|
|
240
|
-
async acquire(promises = this.connections) {
|
|
241
|
-
while (!promises.isEmpty()) {
|
|
242
|
-
const item = promises.peek();
|
|
243
|
-
item().catch((...args) => {
|
|
244
|
-
Promise.reject(...args);
|
|
245
|
-
});
|
|
246
|
-
promises.pop();
|
|
247
|
-
}
|
|
248
|
-
return Promise.resolve(true);
|
|
249
|
-
}
|
|
250
68
|
static chunk(array, chunks) {
|
|
251
69
|
let index = 0;
|
|
252
70
|
let resIndex = 0;
|
|
253
|
-
const result = Array(Math.ceil(array.length / chunks));
|
|
71
|
+
const result = new Array(Math.ceil(array.length / chunks));
|
|
254
72
|
while (index < array.length) {
|
|
255
73
|
result[resIndex] = array.slice(index, (index += chunks));
|
|
256
74
|
resIndex++;
|
|
@@ -258,4 +76,4 @@ class SequentialBucket {
|
|
|
258
76
|
return result;
|
|
259
77
|
}
|
|
260
78
|
}
|
|
261
|
-
exports.
|
|
79
|
+
exports.DynamicBucket = DynamicBucket;
|
|
@@ -15,6 +15,6 @@ export declare class ConnectQueue {
|
|
|
15
15
|
}[];
|
|
16
16
|
protected interval?: NodeJS.Timeout;
|
|
17
17
|
constructor(intervalTime?: number, concurrency?: number);
|
|
18
|
-
push(callback: () => any): void
|
|
19
|
-
shift(): any
|
|
18
|
+
push(callback: () => any): Promise<void>;
|
|
19
|
+
shift(): Promise<any>;
|
|
20
20
|
}
|
|
@@ -9,18 +9,15 @@ class ConnectTimeout {
|
|
|
9
9
|
this.intervalTime = intervalTime;
|
|
10
10
|
}
|
|
11
11
|
wait() {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
this.promises.push(resolve);
|
|
23
|
-
return promise;
|
|
12
|
+
return new Promise(res => {
|
|
13
|
+
if (!this.promises.length) {
|
|
14
|
+
this.interval = setInterval(() => {
|
|
15
|
+
this.shift();
|
|
16
|
+
}, this.intervalTime);
|
|
17
|
+
res(true);
|
|
18
|
+
}
|
|
19
|
+
this.promises.push(res);
|
|
20
|
+
});
|
|
24
21
|
}
|
|
25
22
|
shift() {
|
|
26
23
|
this.promises.shift()?.(true);
|
|
@@ -40,11 +37,11 @@ class ConnectQueue {
|
|
|
40
37
|
this.intervalTime = intervalTime;
|
|
41
38
|
this.concurrency = concurrency;
|
|
42
39
|
}
|
|
43
|
-
push(callback) {
|
|
40
|
+
async push(callback) {
|
|
44
41
|
this.queue.push({ cb: callback });
|
|
45
42
|
if (this.queue.length === this.concurrency) {
|
|
46
43
|
for (let i = 0; i < this.concurrency; i++) {
|
|
47
|
-
this.queue[i].cb?.();
|
|
44
|
+
await this.queue[i].cb?.();
|
|
48
45
|
this.queue[i].cb = undefined;
|
|
49
46
|
}
|
|
50
47
|
this.interval = setInterval(() => {
|
|
@@ -54,7 +51,7 @@ class ConnectQueue {
|
|
|
54
51
|
}, this.intervalTime);
|
|
55
52
|
}
|
|
56
53
|
}
|
|
57
|
-
shift() {
|
|
54
|
+
async shift() {
|
|
58
55
|
const shift = this.queue.shift();
|
|
59
56
|
if (!shift) {
|
|
60
57
|
if (!this.queue.length) {
|
|
@@ -65,7 +62,7 @@ class ConnectQueue {
|
|
|
65
62
|
}
|
|
66
63
|
if (!shift.cb)
|
|
67
64
|
return this.shift();
|
|
68
|
-
shift.cb?.();
|
|
65
|
+
await shift.cb?.();
|
|
69
66
|
if (!this.queue.length) {
|
|
70
67
|
clearInterval(this.interval);
|
|
71
68
|
this.interval = undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "seyfert",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "The most advanced framework for discord bots",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"module": "./lib/index.js",
|
|
@@ -71,4 +71,4 @@
|
|
|
71
71
|
"url": "https://github.com/socram03"
|
|
72
72
|
}
|
|
73
73
|
]
|
|
74
|
-
}
|
|
74
|
+
}
|
package/lib/api/CDN.d.ts
DELETED
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import { type ImageExtension, type ImageSize, type StickerExtension } from './utils/constants.js';
|
|
2
|
-
/**
|
|
3
|
-
* The options used for image URLs
|
|
4
|
-
*/
|
|
5
|
-
export interface BaseImageURLOptions {
|
|
6
|
-
/**
|
|
7
|
-
* The extension to use for the image URL
|
|
8
|
-
*
|
|
9
|
-
* @defaultValue `'webp'`
|
|
10
|
-
*/
|
|
11
|
-
extension?: ImageExtension;
|
|
12
|
-
/**
|
|
13
|
-
* The size specified in the image URL
|
|
14
|
-
*/
|
|
15
|
-
size?: ImageSize;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* The options used for image URLs with animated content
|
|
19
|
-
*/
|
|
20
|
-
export interface ImageURLOptions extends BaseImageURLOptions {
|
|
21
|
-
/**
|
|
22
|
-
* Whether or not to prefer the static version of an image asset.
|
|
23
|
-
*/
|
|
24
|
-
forceStatic?: boolean;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* The options to use when making a CDN URL
|
|
28
|
-
*/
|
|
29
|
-
export interface MakeURLOptions {
|
|
30
|
-
/**
|
|
31
|
-
* The allowed extensions that can be used
|
|
32
|
-
*/
|
|
33
|
-
allowedExtensions?: readonly string[];
|
|
34
|
-
/**
|
|
35
|
-
* The extension to use for the image URL
|
|
36
|
-
*
|
|
37
|
-
* @defaultValue `'webp'`
|
|
38
|
-
*/
|
|
39
|
-
extension?: ImageExtension | StickerExtension | undefined;
|
|
40
|
-
/**
|
|
41
|
-
* The size specified in the image URL
|
|
42
|
-
*/
|
|
43
|
-
size?: ImageSize;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* The CDN link builder
|
|
47
|
-
*/
|
|
48
|
-
export declare class CDN {
|
|
49
|
-
private readonly base;
|
|
50
|
-
constructor(base?: string);
|
|
51
|
-
/**
|
|
52
|
-
* Generates an app asset URL for a client's asset.
|
|
53
|
-
*
|
|
54
|
-
* @param clientId - The client id that has the asset
|
|
55
|
-
* @param assetHash - The hash provided by Discord for this asset
|
|
56
|
-
* @param options - Optional options for the asset
|
|
57
|
-
*/
|
|
58
|
-
appAsset(clientId: string, assetHash: string, options?: Readonly<BaseImageURLOptions>): string;
|
|
59
|
-
/**
|
|
60
|
-
* Generates an app icon URL for a client's icon.
|
|
61
|
-
*
|
|
62
|
-
* @param clientId - The client id that has the icon
|
|
63
|
-
* @param iconHash - The hash provided by Discord for this icon
|
|
64
|
-
* @param options - Optional options for the icon
|
|
65
|
-
*/
|
|
66
|
-
appIcon(clientId: string, iconHash: string, options?: Readonly<BaseImageURLOptions>): string;
|
|
67
|
-
/**
|
|
68
|
-
* Generates an avatar URL, e.g. for a user or a webhook.
|
|
69
|
-
*
|
|
70
|
-
* @param id - The id that has the icon
|
|
71
|
-
* @param avatarHash - The hash provided by Discord for this avatar
|
|
72
|
-
* @param options - Optional options for the avatar
|
|
73
|
-
*/
|
|
74
|
-
avatar(id: string, avatarHash: string, options?: Readonly<ImageURLOptions>): string;
|
|
75
|
-
/**
|
|
76
|
-
* Generates a user avatar decoration URL.
|
|
77
|
-
*
|
|
78
|
-
* @param userId - The id of the user
|
|
79
|
-
* @param userAvatarDecoration - The hash provided by Discord for this avatar decoration
|
|
80
|
-
* @param options - Optional options for the avatar decoration
|
|
81
|
-
*/
|
|
82
|
-
avatarDecoration(userId: string, userAvatarDecoration: string, options?: Readonly<BaseImageURLOptions>): string;
|
|
83
|
-
/**
|
|
84
|
-
* Generates a banner URL, e.g. for a user or a guild.
|
|
85
|
-
*
|
|
86
|
-
* @param id - The id that has the banner splash
|
|
87
|
-
* @param bannerHash - The hash provided by Discord for this banner
|
|
88
|
-
* @param options - Optional options for the banner
|
|
89
|
-
*/
|
|
90
|
-
banner(id: string, bannerHash: string, options?: Readonly<ImageURLOptions>): string;
|
|
91
|
-
/**
|
|
92
|
-
* Generates an icon URL for a channel, e.g. a group DM.
|
|
93
|
-
*
|
|
94
|
-
* @param channelId - The channel id that has the icon
|
|
95
|
-
* @param iconHash - The hash provided by Discord for this channel
|
|
96
|
-
* @param options - Optional options for the icon
|
|
97
|
-
*/
|
|
98
|
-
channelIcon(channelId: string, iconHash: string, options?: Readonly<BaseImageURLOptions>): string;
|
|
99
|
-
/**
|
|
100
|
-
* Generates a default avatar URL
|
|
101
|
-
*
|
|
102
|
-
* @param index - The default avatar index
|
|
103
|
-
* @remarks
|
|
104
|
-
* To calculate the index for a user do `(userId >> 22) % 6`,
|
|
105
|
-
* or `discriminator % 5` if they're using the legacy username system.
|
|
106
|
-
*/
|
|
107
|
-
defaultAvatar(index: number): string;
|
|
108
|
-
/**
|
|
109
|
-
* Generates a discovery splash URL for a guild's discovery splash.
|
|
110
|
-
*
|
|
111
|
-
* @param guildId - The guild id that has the discovery splash
|
|
112
|
-
* @param splashHash - The hash provided by Discord for this splash
|
|
113
|
-
* @param options - Optional options for the splash
|
|
114
|
-
*/
|
|
115
|
-
discoverySplash(guildId: string, splashHash: string, options?: Readonly<BaseImageURLOptions>): string;
|
|
116
|
-
/**
|
|
117
|
-
* Generates an emoji's URL for an emoji.
|
|
118
|
-
*
|
|
119
|
-
* @param emojiId - The emoji id
|
|
120
|
-
* @param options - Optional options for the emoji
|
|
121
|
-
*/
|
|
122
|
-
emoji(emojiId: string, options?: Readonly<BaseImageURLOptions>): string;
|
|
123
|
-
/**
|
|
124
|
-
* Generates a guild member avatar URL.
|
|
125
|
-
*
|
|
126
|
-
* @param guildId - The id of the guild
|
|
127
|
-
* @param userId - The id of the user
|
|
128
|
-
* @param avatarHash - The hash provided by Discord for this avatar
|
|
129
|
-
* @param options - Optional options for the avatar
|
|
130
|
-
*/
|
|
131
|
-
guildMemberAvatar(guildId: string, userId: string, avatarHash: string, options?: Readonly<ImageURLOptions>): string;
|
|
132
|
-
/**
|
|
133
|
-
* Generates a guild member banner URL.
|
|
134
|
-
*
|
|
135
|
-
* @param guildId - The id of the guild
|
|
136
|
-
* @param userId - The id of the user
|
|
137
|
-
* @param bannerHash - The hash provided by Discord for this banner
|
|
138
|
-
* @param options - Optional options for the banner
|
|
139
|
-
*/
|
|
140
|
-
guildMemberBanner(guildId: string, userId: string, bannerHash: string, options?: Readonly<ImageURLOptions>): string;
|
|
141
|
-
/**
|
|
142
|
-
* Generates an icon URL, e.g. for a guild.
|
|
143
|
-
*
|
|
144
|
-
* @param id - The id that has the icon splash
|
|
145
|
-
* @param iconHash - The hash provided by Discord for this icon
|
|
146
|
-
* @param options - Optional options for the icon
|
|
147
|
-
*/
|
|
148
|
-
icon(id: string, iconHash: string, options?: Readonly<ImageURLOptions>): string;
|
|
149
|
-
/**
|
|
150
|
-
* Generates a URL for the icon of a role
|
|
151
|
-
*
|
|
152
|
-
* @param roleId - The id of the role that has the icon
|
|
153
|
-
* @param roleIconHash - The hash provided by Discord for this role icon
|
|
154
|
-
* @param options - Optional options for the role icon
|
|
155
|
-
*/
|
|
156
|
-
roleIcon(roleId: string, roleIconHash: string, options?: Readonly<BaseImageURLOptions>): string;
|
|
157
|
-
/**
|
|
158
|
-
* Generates a guild invite splash URL for a guild's invite splash.
|
|
159
|
-
*
|
|
160
|
-
* @param guildId - The guild id that has the invite splash
|
|
161
|
-
* @param splashHash - The hash provided by Discord for this splash
|
|
162
|
-
* @param options - Optional options for the splash
|
|
163
|
-
*/
|
|
164
|
-
splash(guildId: string, splashHash: string, options?: Readonly<BaseImageURLOptions>): string;
|
|
165
|
-
/**
|
|
166
|
-
* Generates a sticker URL.
|
|
167
|
-
*
|
|
168
|
-
* @param stickerId - The sticker id
|
|
169
|
-
* @param extension - The extension of the sticker
|
|
170
|
-
* @privateRemarks
|
|
171
|
-
* Stickers cannot have a `.webp` extension, so we default to a `.png`
|
|
172
|
-
*/
|
|
173
|
-
sticker(stickerId: string, extension?: StickerExtension): string;
|
|
174
|
-
/**
|
|
175
|
-
* Generates a sticker pack banner URL.
|
|
176
|
-
*
|
|
177
|
-
* @param bannerId - The banner id
|
|
178
|
-
* @param options - Optional options for the banner
|
|
179
|
-
*/
|
|
180
|
-
stickerPackBanner(bannerId: string, options?: Readonly<BaseImageURLOptions>): string;
|
|
181
|
-
/**
|
|
182
|
-
* Generates a team icon URL for a team's icon.
|
|
183
|
-
*
|
|
184
|
-
* @param teamId - The team id that has the icon
|
|
185
|
-
* @param iconHash - The hash provided by Discord for this icon
|
|
186
|
-
* @param options - Optional options for the icon
|
|
187
|
-
*/
|
|
188
|
-
teamIcon(teamId: string, iconHash: string, options?: Readonly<BaseImageURLOptions>): string;
|
|
189
|
-
/**
|
|
190
|
-
* Generates a cover image for a guild scheduled event.
|
|
191
|
-
*
|
|
192
|
-
* @param scheduledEventId - The scheduled event id
|
|
193
|
-
* @param coverHash - The hash provided by discord for this cover image
|
|
194
|
-
* @param options - Optional options for the cover image
|
|
195
|
-
*/
|
|
196
|
-
guildScheduledEventCover(scheduledEventId: string, coverHash: string, options?: Readonly<BaseImageURLOptions>): string;
|
|
197
|
-
/**
|
|
198
|
-
* Constructs the URL for the resource, checking whether or not `hash` starts with `a_` if `dynamic` is set to `true`.
|
|
199
|
-
*
|
|
200
|
-
* @param route - The base cdn route
|
|
201
|
-
* @param hash - The hash provided by Discord for this icon
|
|
202
|
-
* @param options - Optional options for the link
|
|
203
|
-
*/
|
|
204
|
-
private dynamicMakeURL;
|
|
205
|
-
/**
|
|
206
|
-
* Constructs the URL for the resource
|
|
207
|
-
*
|
|
208
|
-
* @param route - The base cdn route
|
|
209
|
-
* @param options - The extension/size options for the link
|
|
210
|
-
*/
|
|
211
|
-
private makeURL;
|
|
212
|
-
}
|