-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtypings.d.ts
687 lines (588 loc) · 12.9 KB
/
typings.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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
/**
* @file Typings File.
* @author Naman Vrati
* @since 2.0.0
* @version 3.0.0
*/
import * as Discord from 'discord.js';
/**
* Represents a chat-based Message Command.
*/
export interface LegacyCommand {
/**
* The name of the command.
*/
name: string;
/**
* Aliases or similar names for the command.
*/
aliases?: string[];
/**
* The description of the command.
*/
description?: string;
/**
* The usage of the command.
*/
usage?: string;
/**
* The permissions required by a discord user to run this command.
*/
permissions?: Discord.PermissionResolvable;
/**
* Whether this command is only a guild-based command.
*/
guildOnly?: boolean;
/**
* Whether this command requires arguments.
*/
args?: boolean;
/**
* The cooldown in seconds of this command.
*/
cooldown?: number;
/**
* Whether this command is only a bot owner-based command.
*/
ownerOnly?: boolean;
/**
* The command executor when it is called by the template handler.
* @param message The message that triggered this command.
* @param args The message arguments of the command (seperated by spaces (' ') in an array, this excludes prefix and command/alias itself).
*/
execute(
message: Discord.Message & { client: Client },
args: string[],
): void | Promise<void>;
}
/**
* Represents an Application Command (Slash Command).
*/
export interface SlashInteractionCommand {
/**
* The data of Application Command Interaction (Slash Command).
*/
data: Discord.SlashCommandBuilder;
options: Array<
| Discord.SlashCommandStringOption
| Discord.SlashCommandNumberOption
| Discord.SlashCommandRoleOption
| Discord.SlashCommandUserOption
| Discord.SlashCommandBooleanOption
| Discord.SlashCommandChannelOption
| Discord.SlashCommandIntegerOption
>;
/**
* Represents whether this command is an owner only command.
*/
ownerOnly: boolean;
/**
* The cooldown in seconds of this command.
*/
cooldown?: number;
/**
* The interaction executor when it is called by the template handler.
* @param interaction The interaction that triggered this command.
*/
execute(
interaction: Discord.ChatInputCommandInteraction & { client: Client },
): void | Promise<void>;
}
/**
* Represents a Button Interaction.
*/
export interface ButtonInteractionCommand {
/**
* The custom ID of the button which was interacted with.
*/
id: string;
/**
* The interaction executor when it is called by the template handler.
* @param interaction The interaction that triggered this command.
*/
execute(
interaction: Discord.ButtonInteraction & { client: Client },
): void | Promise<void>;
}
/**
* Represents a Select Interaction.
*/
export interface SelectInteractionCommand {
/**
* The custom ID of the select (menu option) which was interacted with.
*/
id: string;
/**
* The interaction executor when it is called by the template handler.
* @param interaction The interaction that triggered this command.
*/
execute(
interaction: Discord.SelectMenuInteraction & { client: Client },
): void | Promise<void>;
}
/**
* The data of Context Menu Interaction Command.
*/
export interface ContextInteractionCommandData {
/**
* The name of the context (menu option) which was interacted with.
*/
name: string;
/**
* The type of the context (menu option) which was interacted with.
* 2: User Based Context Menu Option.
* 3: Message Based Context Menu Option.
*/
type: 2 | 3;
}
/**
* Represents a Context Interaction.
*/
export interface ContextInteractionCommand {
/**
* The data of Context Menu Interaction Command.
*/
data: ContextInteractionCommandData;
/**
* The interaction executor when it is called by the template handler.
* @param interaction The interaction that triggered this command.
*/
execute(
interaction: Discord.ContextMenuInteraction & { client: Client },
): void | Promise<void>;
}
/**
* Represents a ModalSubmit Interaction.
*/
export interface ModalInteractionCommand {
/**
* The custom ID of the modal (submit) which was interacted with.
*/
id: string;
/**
* The interaction executor when it is called by the template handler.
* @param interaction The interaction that triggered this command.
*/
execute(
interaction: Discord.ModalSubmitInteraction & { client: Client },
): void | Promise<void>;
}
/**
* Represents a chat-based Trigger Command.
*/
export interface TriggerCommand {
/**
* The names / aliases of the trigger command.
*/
name: string[];
/**
* The command executor when it is called by the template handler.
* @param message The message that triggered this command.
* @param args The message arguments of the command (seperated by spaces (' ') in an array).
*/
execute(
message: Discord.Message & { client: Client },
args: string[],
): void | Promise<void>;
}
/**
* Modified in-built Client that includes support for command/event handlers.
*/
export interface Client extends Discord.Client {
/**
* Represents a collection of chat-based Message Commands.
*/
commands: Discord.Collection<string, LegacyCommand>;
/**
* Represents a collection of Application Commands (Slash Commands).
*/
slashCommands: Discord.Collection<string, SlashInteractionCommand>;
/**
* Represents a collection of Button Interactions.
*/
buttonCommands: Discord.Collection<string, ButtonInteractionCommand>;
/**
* Represents a collection of Select Interactions.
*/
selectCommands: Discord.Collection<string, SelectInteractionCommand>;
/**
* Represents a collection of Context Interactions.
*/
contextCommands: Discord.Collection<string, ContextInteractionCommand>;
/**
* Represents a collection of ModalSubmit Interactions.
*/
modalCommands: Discord.Collection<string, ModalInteractionCommand>;
/**
* Represents cooldown collection for Legacy Commands.
*/
cooldowns: Discord.Collection<string, Discord.Collection<string, number>>;
/**
* Represents a collection of chat-based Trigger Commands.
*/
triggers: Discord.Collection<string, TriggerCommand>;
/**
* Represents a collection of autocomplete interactions.
*/
autocompleteInteractions: Discord.Collection<
string,
AutocompleteInteraction
>;
/**
* Represents Economy Cache Handling.
*/
economy: {
/**
* Represents Cache Heat.
*/
heat: number;
};
}
// Custom Typings for NamVr Chat Economy!
/**
* Represents a Autocomplete Interaction.
*/
export interface AutocompleteInteraction {
/**
* The command name of the autocomplete interaction which was interacted with.
*/
name: string;
/**
* The interaction executor when it is called by the template handler.
* @param interaction The interaction that triggered this command.
*/
execute(
interaction: Discord.AutocompleteInteraction & { client: Client },
): void | Promise<void>;
}
/**
* Represents an Item of Shop Database.
*/
export interface ShopItem {
/**
* Name of the item
*/
name: string;
/**
* Price/Cost of the item (10-100000)
*/
price: number;
/**
* Description of the item
*/
description: string;
}
/**
* Represents a User of User Database.
*/
export interface UserItem {
/**
* User ID of the User.
*/
user_id: Discord.Snowflake;
/**
* Balance of the User.
*/
balance: number;
/**
* Number of times the user has won a chat event.
*/
won_times: number;
/**
* Represents Time-Based Data (daily/weekly commands).
*/
time_data: {
/**
* Represents Data for Daily Command.
*/
daily: {
/**
* Timestamp of the last daily "command" claim.
*/
last: number;
/**
* Streak count of daily "command" claim.
*/
streak: number;
};
};
/**
* Storage of Quantity of Items (item_name: number)
*/
items: Object;
}
/**
* Represents User Database (Users Array).
*/
export interface UserDatabase extends Array<UserItem> {}
/**
* Represents Shop Database (Items Array).
*/
export interface ShopDatabase extends Array<ShopItem> {}
/**
* Represents Configuration File (config.json).
*/
export interface ConfigurationFile {
/**
* Represents internal configuration of the application.
*/
internal: {
/**
* Token of the application.
*/
token: string;
/**
* Owner ID of the application.
*/
owner_id: Discord.Snowflake;
/**
* Client ID of the application.
*/
client_id: Discord.Snowflake;
/**
* Guild ID of the application.
*/
guild_id: Discord.Snowflake;
};
/**
* Represents Economy/Bot based configuration of the application.
*/
settings: {
/**
* Prefix of the application.
*/
prefix: string;
/**
* Amount of maximum heat (trigger).
*/
heat_max: number;
/**
* Amount of heat per message (to be added).
*/
heat_per_msg: number;
/**
* Cooldown of Legacy Commands (in ms).
*/
cooldown: number;
/**
* Chat Channel ID (Heat Channel).
*/
chat_channel: Discord.Snowflake;
/**
* Bot Channel ID (Ecoshop Channel).
*/
bot_channel: Discord.Snowflake;
/**
* Maximum currency awarded to event winner.
*/
win_max: number;
/**
* Minimum currency awarded to event winner.
*/
win_min: number;
/**
* Represents bot's currency settings.
*/
currency: {
/**
* Name of your server's currency.
*/
name: string;
/**
* Emoji (symbol) of your server's currency.
*/
emoji: Discord.EmojiResolvable;
};
};
/**
* Represents specific command settings for the application.
*/
commands: {
/**
* Represents Daily Command Settings.
*/
daily: {
/**
* Amount to be credited daily.
*/
amount: number;
/**
* Amount to be bonus for daily streaks.
*/
streak: number;
};
/**
* Represents Beg Command Settings.
*/
beg: {
/**
* Maximum (Positive) Amount to be added.
*/
positive_max: number;
/**
* Minimum (Positive) Amount to be added.
*/
positive_min: number;
/**
* Maximum (Negative) Amount to be removed.
*/
negative_max: number;
/**
* Minimum (Negative) Amount to be removed.
*/
negative_min: number;
};
/**
* Represents Search Command Settings.
*/
search: {
/**
* Minimum currency awarded to winner.
*/
min: number;
/**
* Maximum currency awarded to winner.
*/
max: number;
/**
* Percentage of amount of wallet to loose after dying (0-100).
*/
wallet_lost: number;
};
/**
* Represents Work Command Settings.
*/
work: {
/**
* Minimum currency awarded to winner.
*/
min: number;
/**
* Maximum currency awarded to winner.
*/
max: number;
/**
* Percentage of amount of wallet to loose after dying (0-100).
*/
wallet_lost: number;
};
};
/**
* Represents API Link/Keys for the application.
*/
apis: {
/**
* API Link for Wordnik (Unscramble The Word)
*/
wordnik: string;
/**
* API Link for Open Trivia Database (Trivia Night)
*/
opentdb: string;
};
/**
* Represents Modules toggles (enabled or disabled).
*/
modules: {
/**
* Whether Math Equation Module is enabled or not.
*/
math_equation: boolean;
/**
* Whether Speed Clicker Module is enabled or not.
*/
speed_clicker: boolean;
/**
* Whether Speed Typer Module is enabled or not.
*/
speed_typer: boolean;
/**
* Whether Unscramble The Word Module is enabled or not.
*/
unscramble_the_word: boolean;
/**
* Whether Trivia Night Module is enabled or not.
*/
trivia_night: boolean;
};
}
/**
* Represents a Wordnik Response Object.
*/
export interface WordnikResponseObject {
/**
* The ID (Index).
*/
id: number;
/**
* The Random Word.
*/
word: string;
}
/**
* Represents a Wordnik Response Data.
*/
export interface WordnikResponse extends Array<WordnikResponseObject> {}
/**
* Represents a OpenTDB Response Object.
*/
export interface OpenTDBResponseObject {
/**
* The category of the question (eg General Knowledge).
*/
category: string;
/**
* The type of the question (Multiple Choice).
*/
type: string;
/**
* The difficultly of the question (eg Medium).
*/
difficulty: string;
/**
* The actual trivia question.
*/
question: string;
/**
* The correct answer to the question.
*/
correct_answer: string;
/**
* The incorrect answers to the question.
*/
incorrect_answers: Array<string>;
}
/**
* Represents a OpenTDB Response Data.
*/
export interface OpenTDBResponse {
/**
* The Response Code from the API.
*/
response_code: number;
/**
* The Results Array Response From the API.
*/
results: Array<OpenTDBResponseObject>;
}
/**
* Represents a Chat-Event (Trigger).
*/
export interface ChatTriggerEvent {
/**
* The event name of the chat-trigger which was interacted with.
*/
name: string;
/**
* The config name of the chat-trigger which was interacted with.
* Generally `variable_case` version of `name` property.
*/
alias: string;
/**
* The event executor when it is called by the template handler.
* @param message The message that triggered this command.
*/
execute(
message: Discord.Message & { client: Client },
): void | Promise<void>;
}