@mostfeatured/dbi 0.0.55 → 0.0.57

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.
Files changed (65) hide show
  1. package/dist/DBI.d.ts +156 -156
  2. package/dist/DBI.js +332 -332
  3. package/dist/Events.d.ts +53 -53
  4. package/dist/Events.js +58 -58
  5. package/dist/data/eventMap.json +234 -234
  6. package/dist/index.d.ts +6 -6
  7. package/dist/index.js +16 -16
  8. package/dist/methods/hookEventListeners.d.ts +3 -3
  9. package/dist/methods/hookEventListeners.js +87 -87
  10. package/dist/methods/hookInteractionListeners.d.ts +3 -3
  11. package/dist/methods/hookInteractionListeners.d.ts.map +1 -1
  12. package/dist/methods/hookInteractionListeners.js +125 -118
  13. package/dist/methods/hookInteractionListeners.js.map +1 -1
  14. package/dist/methods/publishInteractions.d.ts +7 -7
  15. package/dist/methods/publishInteractions.js +238 -238
  16. package/dist/types/Button.d.ts +18 -18
  17. package/dist/types/Button.js +31 -31
  18. package/dist/types/ButtonBuilder.d.ts +29 -29
  19. package/dist/types/ButtonBuilder.js +42 -42
  20. package/dist/types/ChatInput/ChatInput.d.ts +15 -15
  21. package/dist/types/ChatInput/ChatInput.js +20 -20
  22. package/dist/types/ChatInput/ChatInputOptions.d.ts +162 -162
  23. package/dist/types/ChatInput/ChatInputOptions.js +161 -161
  24. package/dist/types/CustomEvent.d.ts +13 -13
  25. package/dist/types/CustomEvent.js +19 -19
  26. package/dist/types/Event.d.ts +263 -263
  27. package/dist/types/Event.js +22 -22
  28. package/dist/types/Interaction.d.ts +47 -47
  29. package/dist/types/Interaction.js +24 -24
  30. package/dist/types/InteractionLocale.d.ts +25 -25
  31. package/dist/types/InteractionLocale.js +14 -14
  32. package/dist/types/Locale.d.ts +21 -21
  33. package/dist/types/Locale.js +38 -38
  34. package/dist/types/MessageContextMenu.d.ts +14 -14
  35. package/dist/types/MessageContextMenu.js +18 -18
  36. package/dist/types/Modal.d.ts +22 -22
  37. package/dist/types/Modal.js +29 -29
  38. package/dist/types/ModalBuilder.d.ts +30 -30
  39. package/dist/types/ModalBuilder.js +42 -42
  40. package/dist/types/SelectMenu.d.ts +18 -18
  41. package/dist/types/SelectMenu.d.ts.map +1 -1
  42. package/dist/types/SelectMenu.js +31 -31
  43. package/dist/types/SelectMenu.js.map +1 -1
  44. package/dist/types/SelectMenuBuilder.d.ts +27 -27
  45. package/dist/types/SelectMenuBuilder.d.ts.map +1 -1
  46. package/dist/types/SelectMenuBuilder.js +42 -42
  47. package/dist/types/SelectMenuBuilder.js.map +1 -1
  48. package/dist/types/UserContextMenu.d.ts +14 -14
  49. package/dist/types/UserContextMenu.js +18 -18
  50. package/dist/utils/MemoryStore.d.ts +8 -8
  51. package/dist/utils/MemoryStore.js +29 -29
  52. package/dist/utils/UtilTypes.d.ts +7 -7
  53. package/dist/utils/UtilTypes.js +2 -2
  54. package/dist/utils/customId.d.ts +7 -7
  55. package/dist/utils/customId.js +45 -45
  56. package/dist/utils/permissions.d.ts +2 -2
  57. package/dist/utils/permissions.js +8 -8
  58. package/dist/utils/recursiveImport.d.ts +4 -4
  59. package/dist/utils/recursiveImport.js +26 -26
  60. package/package.json +1 -1
  61. package/readme.md +5 -5
  62. package/src/methods/hookInteractionListeners.ts +7 -0
  63. package/src/types/SelectMenu.ts +2 -2
  64. package/src/types/SelectMenuBuilder.ts +3 -3
  65. package/test.js +0 -34
@@ -1,239 +1,239 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatLocale = exports.localeifyOptions = exports.publishInteractions = void 0;
4
- const rest_1 = require("@discordjs/rest");
5
- const v9_1 = require("discord-api-types/v9");
6
- const permissions_1 = require("../utils/permissions");
7
- const PUBLISHABLE_TYPES = ["ChatInput", "UserContextMenu", "MessageContextMenu"];
8
- const ORIGINAL_LOCALES = ["da", "de", "en-GB", "en-US", "es-ES", "fr", "hr", "it", "lt", "hu", "nl", "no", "pl", "pt-BR", "ro", "fi", "sv-SE", "vi", "tr", "cs", "el", "bg", "ru", "uk", "hi", "th", "zh-CN", "ja", "zh-TW", "ko"];
9
- async function publishInteractions(clientToken, interactions, interactionsLocales, publishType, guildId) {
10
- interactions = interactions.filter(i => PUBLISHABLE_TYPES.includes(i.type));
11
- const rest = new rest_1.REST({ version: "10" });
12
- rest.setToken(clientToken);
13
- const me = await rest.get(v9_1.Routes.user());
14
- interactions = interactions.sort((a, b) => b.name.split(" ").length - a.name.split(" ").length);
15
- let body = interactions.reduce((all, current) => {
16
- switch (current.type) {
17
- case "ChatInput": {
18
- let nameSplitted = current.name.split(" ");
19
- let localeData = formatLocale(interactionsLocales.get(current.name) ?? {});
20
- switch (nameSplitted.length) {
21
- case 1: {
22
- all.push({
23
- type: v9_1.ApplicationCommandType.ChatInput,
24
- description: current.description,
25
- name: nameSplitted[0],
26
- default_member_permissions: (0, permissions_1.reducePermissions)(current.defaultMemberPermissions).toString(),
27
- dm_permission: current.directMessages,
28
- options: localeifyOptions(current.options || [], localeData.optionsLocales),
29
- name_localizations: localeData.nameLocales(0),
30
- description_localizations: localeData.descriptionLocales,
31
- });
32
- break;
33
- }
34
- case 2: {
35
- let baseItem = all.find(i => i.name == current.name.split(" ")[0] && i.type == v9_1.ApplicationCommandType.ChatInput);
36
- let localeData = formatLocale(interactionsLocales.get(current.name) ?? {});
37
- let option = {
38
- type: v9_1.ApplicationCommandOptionType.Subcommand,
39
- name: nameSplitted[1],
40
- description: current.description,
41
- default_member_permissions: (0, permissions_1.reducePermissions)(current.defaultMemberPermissions).toString(),
42
- dm_permission: current.directMessages,
43
- options: localeifyOptions(current.options || [], localeData.optionsLocales),
44
- name_localizations: localeData.nameLocales(1),
45
- description_localizations: localeData.descriptionLocales,
46
- };
47
- if (!baseItem) {
48
- all.push({
49
- type: v9_1.ApplicationCommandType.ChatInput,
50
- name: nameSplitted[0],
51
- name_localizations: localeData.nameLocales(0),
52
- description: "...",
53
- options: [
54
- option
55
- ]
56
- });
57
- }
58
- else {
59
- baseItem.options.push(option);
60
- }
61
- break;
62
- }
63
- case 3: {
64
- let level1Item = all.find(i => i.name == current.name.split(" ")[0] && i.type == v9_1.ApplicationCommandType.ChatInput);
65
- let localeData = formatLocale(interactionsLocales.get(current.name) ?? {});
66
- if (!level1Item) {
67
- all.push({
68
- type: v9_1.ApplicationCommandType.ChatInput,
69
- name: nameSplitted[0],
70
- name_localizations: localeData.nameLocales(0),
71
- description: "...",
72
- options: [
73
- {
74
- type: v9_1.ApplicationCommandOptionType.SubcommandGroup,
75
- name: nameSplitted[1],
76
- name_localizations: localeData.nameLocales(1),
77
- description: "...",
78
- options: [
79
- {
80
- type: v9_1.ApplicationCommandOptionType.Subcommand,
81
- name: nameSplitted[2],
82
- description: current.description,
83
- default_member_permissions: (0, permissions_1.reducePermissions)(current.defaultMemberPermissions).toString(),
84
- dm_permission: current.directMessages,
85
- options: localeifyOptions(current.options || [], localeData.optionsLocales),
86
- name_localizations: localeData.nameLocales(2),
87
- description_localizations: localeData.descriptionLocales,
88
- }
89
- ]
90
- }
91
- ]
92
- });
93
- }
94
- else {
95
- let level2Item = level1Item.options.find(i => i.name == current.name.split(" ")[1]);
96
- if (!level2Item) {
97
- level1Item.options.push({
98
- type: v9_1.ApplicationCommandOptionType.SubcommandGroup,
99
- name: nameSplitted[1],
100
- name_localizations: localeData.nameLocales(1),
101
- description: "...",
102
- options: [
103
- {
104
- type: v9_1.ApplicationCommandOptionType.Subcommand,
105
- name: nameSplitted[2],
106
- description: current.description,
107
- default_member_permissions: (0, permissions_1.reducePermissions)(current.defaultMemberPermissions).toString(),
108
- dm_permission: current.directMessages,
109
- options: localeifyOptions(current.options || [], localeData.optionsLocales),
110
- name_localizations: localeData.nameLocales(2),
111
- description_localizations: localeData.descriptionLocales
112
- }
113
- ]
114
- });
115
- }
116
- else {
117
- level2Item.options.push({
118
- type: v9_1.ApplicationCommandOptionType.Subcommand,
119
- name: nameSplitted[2],
120
- description: current.description,
121
- default_member_permissions: (0, permissions_1.reducePermissions)(current.defaultMemberPermissions).toString(),
122
- dm_permission: current.directMessages,
123
- options: localeifyOptions(current.options || [], localeData.optionsLocales),
124
- name_localizations: localeData.nameLocales(2),
125
- description_localizations: localeData.descriptionLocales,
126
- });
127
- }
128
- }
129
- break;
130
- }
131
- }
132
- break;
133
- }
134
- case "MessageContextMenu": {
135
- let localeData = formatLocale(interactionsLocales.get(current.name) ?? {});
136
- all.push({
137
- type: v9_1.ApplicationCommandType.Message,
138
- name: current.name,
139
- default_member_permissions: (0, permissions_1.reducePermissions)(current.defaultMemberPermissions).toString(),
140
- dm_permission: current.directMessages,
141
- name_localizations: localeData.allNameLocales,
142
- description_localizations: localeData.descriptionLocales,
143
- });
144
- break;
145
- }
146
- case "UserContextMenu": {
147
- let localeData = formatLocale(interactionsLocales.get(current.name) ?? {});
148
- all.push({
149
- type: v9_1.ApplicationCommandType.User,
150
- name: current.name,
151
- default_member_permissions: (0, permissions_1.reducePermissions)(current.defaultMemberPermissions).toString(),
152
- dm_permission: current.directMessages,
153
- name_localizations: localeData.allNameLocales,
154
- description_localizations: localeData.descriptionLocales
155
- });
156
- break;
157
- }
158
- }
159
- return all;
160
- }, []);
161
- switch (publishType) {
162
- case "Guild": {
163
- await rest.put(v9_1.Routes.applicationGuildCommands(me.id, guildId), { body });
164
- break;
165
- }
166
- case "Global": {
167
- await rest.put(v9_1.Routes.applicationCommands(me.id), { body });
168
- break;
169
- }
170
- }
171
- }
172
- exports.publishInteractions = publishInteractions;
173
- function localeifyOptions(options, localeData) {
174
- return options.map(i => {
175
- let optionData = localeData[i.name];
176
- return optionData ? Object.assign(i, {
177
- name_localizations: optionData.nameLocales,
178
- description_localizations: optionData.descriptionLocales,
179
- choices: i.choices ? i.choices.map((j) => {
180
- let choiceLocale = optionData.choiceLocales[j.name];
181
- return choiceLocale ? Object.assign(j, {
182
- name_localizations: choiceLocale
183
- }) : j;
184
- }) : undefined
185
- }) : i;
186
- });
187
- }
188
- exports.localeifyOptions = localeifyOptions;
189
- function formatLocale(locale) {
190
- let allNameLocales = {};
191
- let descriptionLocales = {};
192
- let optionsLocales = {};
193
- function nameLocales(index) {
194
- return Object.fromEntries(Object.entries(allNameLocales).map(i => [i[0], i[1].split(" ").at(index)]));
195
- }
196
- if (!locale?.data)
197
- return {
198
- nameLocales,
199
- allNameLocales,
200
- descriptionLocales,
201
- optionsLocales
202
- };
203
- Object.entries(locale.data).forEach(([shortLocale, localeData]) => {
204
- let longAliases = ORIGINAL_LOCALES.filter(i => i.split("-").at(0) == shortLocale);
205
- longAliases.forEach((longLocale) => {
206
- allNameLocales[longLocale] = localeData.name;
207
- descriptionLocales[longLocale] = localeData.description;
208
- Object.entries(localeData?.options || {}).forEach(([optionName, optionData]) => {
209
- if (!optionsLocales[optionName])
210
- optionsLocales[optionName] = {};
211
- let optionLocale = optionsLocales[optionName];
212
- if (!optionLocale.nameLocales)
213
- optionLocale.nameLocales = {};
214
- if (!optionLocale.descriptionLocales)
215
- optionLocale.descriptionLocales = {};
216
- if (!optionLocale.choiceLocales)
217
- optionLocale.choiceLocales = {};
218
- Object.entries(optionData?.choices || {}).forEach(([choiceOriginalName, choiceName]) => {
219
- if (!optionLocale.choiceLocales)
220
- optionLocale.choiceLocales = {};
221
- if (!optionLocale.choiceLocales[choiceOriginalName])
222
- optionLocale.choiceLocales[choiceOriginalName] = {};
223
- let choiceLocale = optionLocale.choiceLocales[choiceOriginalName];
224
- choiceLocale[longLocale] = choiceName;
225
- });
226
- optionLocale.nameLocales[longLocale] = optionData.name;
227
- optionLocale.descriptionLocales[longLocale] = optionData.description;
228
- });
229
- });
230
- });
231
- return {
232
- nameLocales,
233
- allNameLocales,
234
- descriptionLocales,
235
- optionsLocales
236
- };
237
- }
238
- exports.formatLocale = formatLocale;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatLocale = exports.localeifyOptions = exports.publishInteractions = void 0;
4
+ const rest_1 = require("@discordjs/rest");
5
+ const v9_1 = require("discord-api-types/v9");
6
+ const permissions_1 = require("../utils/permissions");
7
+ const PUBLISHABLE_TYPES = ["ChatInput", "UserContextMenu", "MessageContextMenu"];
8
+ const ORIGINAL_LOCALES = ["da", "de", "en-GB", "en-US", "es-ES", "fr", "hr", "it", "lt", "hu", "nl", "no", "pl", "pt-BR", "ro", "fi", "sv-SE", "vi", "tr", "cs", "el", "bg", "ru", "uk", "hi", "th", "zh-CN", "ja", "zh-TW", "ko"];
9
+ async function publishInteractions(clientToken, interactions, interactionsLocales, publishType, guildId) {
10
+ interactions = interactions.filter(i => PUBLISHABLE_TYPES.includes(i.type));
11
+ const rest = new rest_1.REST({ version: "10" });
12
+ rest.setToken(clientToken);
13
+ const me = await rest.get(v9_1.Routes.user());
14
+ interactions = interactions.sort((a, b) => b.name.split(" ").length - a.name.split(" ").length);
15
+ let body = interactions.reduce((all, current) => {
16
+ switch (current.type) {
17
+ case "ChatInput": {
18
+ let nameSplitted = current.name.split(" ");
19
+ let localeData = formatLocale(interactionsLocales.get(current.name) ?? {});
20
+ switch (nameSplitted.length) {
21
+ case 1: {
22
+ all.push({
23
+ type: v9_1.ApplicationCommandType.ChatInput,
24
+ description: current.description,
25
+ name: nameSplitted[0],
26
+ default_member_permissions: (0, permissions_1.reducePermissions)(current.defaultMemberPermissions).toString(),
27
+ dm_permission: current.directMessages,
28
+ options: localeifyOptions(current.options || [], localeData.optionsLocales),
29
+ name_localizations: localeData.nameLocales(0),
30
+ description_localizations: localeData.descriptionLocales,
31
+ });
32
+ break;
33
+ }
34
+ case 2: {
35
+ let baseItem = all.find(i => i.name == current.name.split(" ")[0] && i.type == v9_1.ApplicationCommandType.ChatInput);
36
+ let localeData = formatLocale(interactionsLocales.get(current.name) ?? {});
37
+ let option = {
38
+ type: v9_1.ApplicationCommandOptionType.Subcommand,
39
+ name: nameSplitted[1],
40
+ description: current.description,
41
+ default_member_permissions: (0, permissions_1.reducePermissions)(current.defaultMemberPermissions).toString(),
42
+ dm_permission: current.directMessages,
43
+ options: localeifyOptions(current.options || [], localeData.optionsLocales),
44
+ name_localizations: localeData.nameLocales(1),
45
+ description_localizations: localeData.descriptionLocales,
46
+ };
47
+ if (!baseItem) {
48
+ all.push({
49
+ type: v9_1.ApplicationCommandType.ChatInput,
50
+ name: nameSplitted[0],
51
+ name_localizations: localeData.nameLocales(0),
52
+ description: "...",
53
+ options: [
54
+ option
55
+ ]
56
+ });
57
+ }
58
+ else {
59
+ baseItem.options.push(option);
60
+ }
61
+ break;
62
+ }
63
+ case 3: {
64
+ let level1Item = all.find(i => i.name == current.name.split(" ")[0] && i.type == v9_1.ApplicationCommandType.ChatInput);
65
+ let localeData = formatLocale(interactionsLocales.get(current.name) ?? {});
66
+ if (!level1Item) {
67
+ all.push({
68
+ type: v9_1.ApplicationCommandType.ChatInput,
69
+ name: nameSplitted[0],
70
+ name_localizations: localeData.nameLocales(0),
71
+ description: "...",
72
+ options: [
73
+ {
74
+ type: v9_1.ApplicationCommandOptionType.SubcommandGroup,
75
+ name: nameSplitted[1],
76
+ name_localizations: localeData.nameLocales(1),
77
+ description: "...",
78
+ options: [
79
+ {
80
+ type: v9_1.ApplicationCommandOptionType.Subcommand,
81
+ name: nameSplitted[2],
82
+ description: current.description,
83
+ default_member_permissions: (0, permissions_1.reducePermissions)(current.defaultMemberPermissions).toString(),
84
+ dm_permission: current.directMessages,
85
+ options: localeifyOptions(current.options || [], localeData.optionsLocales),
86
+ name_localizations: localeData.nameLocales(2),
87
+ description_localizations: localeData.descriptionLocales,
88
+ }
89
+ ]
90
+ }
91
+ ]
92
+ });
93
+ }
94
+ else {
95
+ let level2Item = level1Item.options.find(i => i.name == current.name.split(" ")[1]);
96
+ if (!level2Item) {
97
+ level1Item.options.push({
98
+ type: v9_1.ApplicationCommandOptionType.SubcommandGroup,
99
+ name: nameSplitted[1],
100
+ name_localizations: localeData.nameLocales(1),
101
+ description: "...",
102
+ options: [
103
+ {
104
+ type: v9_1.ApplicationCommandOptionType.Subcommand,
105
+ name: nameSplitted[2],
106
+ description: current.description,
107
+ default_member_permissions: (0, permissions_1.reducePermissions)(current.defaultMemberPermissions).toString(),
108
+ dm_permission: current.directMessages,
109
+ options: localeifyOptions(current.options || [], localeData.optionsLocales),
110
+ name_localizations: localeData.nameLocales(2),
111
+ description_localizations: localeData.descriptionLocales
112
+ }
113
+ ]
114
+ });
115
+ }
116
+ else {
117
+ level2Item.options.push({
118
+ type: v9_1.ApplicationCommandOptionType.Subcommand,
119
+ name: nameSplitted[2],
120
+ description: current.description,
121
+ default_member_permissions: (0, permissions_1.reducePermissions)(current.defaultMemberPermissions).toString(),
122
+ dm_permission: current.directMessages,
123
+ options: localeifyOptions(current.options || [], localeData.optionsLocales),
124
+ name_localizations: localeData.nameLocales(2),
125
+ description_localizations: localeData.descriptionLocales,
126
+ });
127
+ }
128
+ }
129
+ break;
130
+ }
131
+ }
132
+ break;
133
+ }
134
+ case "MessageContextMenu": {
135
+ let localeData = formatLocale(interactionsLocales.get(current.name) ?? {});
136
+ all.push({
137
+ type: v9_1.ApplicationCommandType.Message,
138
+ name: current.name,
139
+ default_member_permissions: (0, permissions_1.reducePermissions)(current.defaultMemberPermissions).toString(),
140
+ dm_permission: current.directMessages,
141
+ name_localizations: localeData.allNameLocales,
142
+ description_localizations: localeData.descriptionLocales,
143
+ });
144
+ break;
145
+ }
146
+ case "UserContextMenu": {
147
+ let localeData = formatLocale(interactionsLocales.get(current.name) ?? {});
148
+ all.push({
149
+ type: v9_1.ApplicationCommandType.User,
150
+ name: current.name,
151
+ default_member_permissions: (0, permissions_1.reducePermissions)(current.defaultMemberPermissions).toString(),
152
+ dm_permission: current.directMessages,
153
+ name_localizations: localeData.allNameLocales,
154
+ description_localizations: localeData.descriptionLocales
155
+ });
156
+ break;
157
+ }
158
+ }
159
+ return all;
160
+ }, []);
161
+ switch (publishType) {
162
+ case "Guild": {
163
+ await rest.put(v9_1.Routes.applicationGuildCommands(me.id, guildId), { body });
164
+ break;
165
+ }
166
+ case "Global": {
167
+ await rest.put(v9_1.Routes.applicationCommands(me.id), { body });
168
+ break;
169
+ }
170
+ }
171
+ }
172
+ exports.publishInteractions = publishInteractions;
173
+ function localeifyOptions(options, localeData) {
174
+ return options.map(i => {
175
+ let optionData = localeData[i.name];
176
+ return optionData ? Object.assign(i, {
177
+ name_localizations: optionData.nameLocales,
178
+ description_localizations: optionData.descriptionLocales,
179
+ choices: i.choices ? i.choices.map((j) => {
180
+ let choiceLocale = optionData.choiceLocales[j.name];
181
+ return choiceLocale ? Object.assign(j, {
182
+ name_localizations: choiceLocale
183
+ }) : j;
184
+ }) : undefined
185
+ }) : i;
186
+ });
187
+ }
188
+ exports.localeifyOptions = localeifyOptions;
189
+ function formatLocale(locale) {
190
+ let allNameLocales = {};
191
+ let descriptionLocales = {};
192
+ let optionsLocales = {};
193
+ function nameLocales(index) {
194
+ return Object.fromEntries(Object.entries(allNameLocales).map(i => [i[0], i[1].split(" ").at(index)]));
195
+ }
196
+ if (!locale?.data)
197
+ return {
198
+ nameLocales,
199
+ allNameLocales,
200
+ descriptionLocales,
201
+ optionsLocales
202
+ };
203
+ Object.entries(locale.data).forEach(([shortLocale, localeData]) => {
204
+ let longAliases = ORIGINAL_LOCALES.filter(i => i.split("-").at(0) == shortLocale);
205
+ longAliases.forEach((longLocale) => {
206
+ allNameLocales[longLocale] = localeData.name;
207
+ descriptionLocales[longLocale] = localeData.description;
208
+ Object.entries(localeData?.options || {}).forEach(([optionName, optionData]) => {
209
+ if (!optionsLocales[optionName])
210
+ optionsLocales[optionName] = {};
211
+ let optionLocale = optionsLocales[optionName];
212
+ if (!optionLocale.nameLocales)
213
+ optionLocale.nameLocales = {};
214
+ if (!optionLocale.descriptionLocales)
215
+ optionLocale.descriptionLocales = {};
216
+ if (!optionLocale.choiceLocales)
217
+ optionLocale.choiceLocales = {};
218
+ Object.entries(optionData?.choices || {}).forEach(([choiceOriginalName, choiceName]) => {
219
+ if (!optionLocale.choiceLocales)
220
+ optionLocale.choiceLocales = {};
221
+ if (!optionLocale.choiceLocales[choiceOriginalName])
222
+ optionLocale.choiceLocales[choiceOriginalName] = {};
223
+ let choiceLocale = optionLocale.choiceLocales[choiceOriginalName];
224
+ choiceLocale[longLocale] = choiceName;
225
+ });
226
+ optionLocale.nameLocales[longLocale] = optionData.name;
227
+ optionLocale.descriptionLocales[longLocale] = optionData.description;
228
+ });
229
+ });
230
+ });
231
+ return {
232
+ nameLocales,
233
+ allNameLocales,
234
+ descriptionLocales,
235
+ optionsLocales
236
+ };
237
+ }
238
+ exports.formatLocale = formatLocale;
239
239
  //# sourceMappingURL=publishInteractions.js.map
@@ -1,19 +1,19 @@
1
- import Discord from "discord.js";
2
- import { DBI } from "../DBI";
3
- import { DBIBaseInteraction, IDBIBaseExecuteCtx, TDBIReferencedData } from "./Interaction";
4
- import { IDBIToJSONArgs } from "../utils/UtilTypes";
5
- import { NamespaceEnums } from "../../generated/namespaceData";
6
- import { DBIButtonBuilder, DBIButtonOverrides } from "./ButtonBuilder";
7
- export interface IDBIButtonExecuteCtx<TNamespace extends NamespaceEnums> extends IDBIBaseExecuteCtx<TNamespace> {
8
- interaction: Discord.ButtonInteraction<"cached">;
9
- data: TDBIReferencedData[];
10
- }
11
- export declare type TDBIButtonOmitted<TNamespace extends NamespaceEnums> = Omit<DBIButton<TNamespace>, "type" | "description" | "dbi" | "toJSON" | "createBuilder">;
12
- export declare class DBIButton<TNamespace extends NamespaceEnums> extends DBIBaseInteraction<TNamespace> {
13
- constructor(dbi: DBI<TNamespace>, args: TDBIButtonOmitted<TNamespace>);
14
- options?: Omit<Discord.ButtonComponentData, "customId" | "type">;
15
- onExecute(ctx: IDBIButtonExecuteCtx<TNamespace>): Promise<void> | void;
16
- toJSON(arg?: IDBIToJSONArgs<DBIButtonOverrides>): Discord.ButtonComponentData;
17
- createBuilder(arg?: IDBIToJSONArgs<DBIButtonOverrides>): DBIButtonBuilder<TNamespace>;
18
- }
1
+ import Discord from "discord.js";
2
+ import { DBI } from "../DBI";
3
+ import { DBIBaseInteraction, IDBIBaseExecuteCtx, TDBIReferencedData } from "./Interaction";
4
+ import { IDBIToJSONArgs } from "../utils/UtilTypes";
5
+ import { NamespaceEnums } from "../../generated/namespaceData";
6
+ import { DBIButtonBuilder, DBIButtonOverrides } from "./ButtonBuilder";
7
+ export interface IDBIButtonExecuteCtx<TNamespace extends NamespaceEnums> extends IDBIBaseExecuteCtx<TNamespace> {
8
+ interaction: Discord.ButtonInteraction<"cached">;
9
+ data: TDBIReferencedData[];
10
+ }
11
+ export declare type TDBIButtonOmitted<TNamespace extends NamespaceEnums> = Omit<DBIButton<TNamespace>, "type" | "description" | "dbi" | "toJSON" | "createBuilder">;
12
+ export declare class DBIButton<TNamespace extends NamespaceEnums> extends DBIBaseInteraction<TNamespace> {
13
+ constructor(dbi: DBI<TNamespace>, args: TDBIButtonOmitted<TNamespace>);
14
+ options?: Omit<Discord.ButtonComponentData, "customId" | "type">;
15
+ onExecute(ctx: IDBIButtonExecuteCtx<TNamespace>): Promise<void> | void;
16
+ toJSON(arg?: IDBIToJSONArgs<DBIButtonOverrides>): Discord.ButtonComponentData;
17
+ createBuilder(arg?: IDBIToJSONArgs<DBIButtonOverrides>): DBIButtonBuilder<TNamespace>;
18
+ }
19
19
  //# sourceMappingURL=Button.d.ts.map
@@ -1,32 +1,32 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DBIButton = void 0;
4
- const tslib_1 = require("tslib");
5
- const discord_js_1 = tslib_1.__importDefault(require("discord.js"));
6
- const Interaction_1 = require("./Interaction");
7
- const customId_1 = require("../utils/customId");
8
- const stuffs_1 = tslib_1.__importDefault(require("stuffs"));
9
- const ButtonBuilder_1 = require("./ButtonBuilder");
10
- class DBIButton extends Interaction_1.DBIBaseInteraction {
11
- constructor(dbi, args) {
12
- super(dbi, {
13
- ...args,
14
- type: "Button",
15
- });
16
- }
17
- onExecute(ctx) { }
18
- ;
19
- toJSON(arg = {}) {
20
- return {
21
- ...stuffs_1.default.defaultify((arg?.overrides || {}), this.options || {}, true),
22
- customId: (0, customId_1.customIdBuilder)(this.dbi, this.name, arg?.reference?.data || [], arg?.reference?.ttl),
23
- type: discord_js_1.default.ComponentType.Button,
24
- };
25
- }
26
- ;
27
- createBuilder(arg = {}) {
28
- return new ButtonBuilder_1.DBIButtonBuilder({ component: this, ...arg });
29
- }
30
- }
31
- exports.DBIButton = DBIButton;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DBIButton = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const discord_js_1 = tslib_1.__importDefault(require("discord.js"));
6
+ const Interaction_1 = require("./Interaction");
7
+ const customId_1 = require("../utils/customId");
8
+ const stuffs_1 = tslib_1.__importDefault(require("stuffs"));
9
+ const ButtonBuilder_1 = require("./ButtonBuilder");
10
+ class DBIButton extends Interaction_1.DBIBaseInteraction {
11
+ constructor(dbi, args) {
12
+ super(dbi, {
13
+ ...args,
14
+ type: "Button",
15
+ });
16
+ }
17
+ onExecute(ctx) { }
18
+ ;
19
+ toJSON(arg = {}) {
20
+ return {
21
+ ...stuffs_1.default.defaultify((arg?.overrides || {}), this.options || {}, true),
22
+ customId: (0, customId_1.customIdBuilder)(this.dbi, this.name, arg?.reference?.data || [], arg?.reference?.ttl),
23
+ type: discord_js_1.default.ComponentType.Button,
24
+ };
25
+ }
26
+ ;
27
+ createBuilder(arg = {}) {
28
+ return new ButtonBuilder_1.DBIButtonBuilder({ component: this, ...arg });
29
+ }
30
+ }
31
+ exports.DBIButton = DBIButton;
32
32
  //# sourceMappingURL=Button.js.map