Codex commited on
Commit ·
178bd89
1
Parent(s): 5488d4e
Fix Discord command option ordering
Browse files- src/commands.js +23 -4
src/commands.js
CHANGED
|
@@ -69,6 +69,25 @@ const MARKET_INTELLIGENCE_MARKET_CHOICES = [
|
|
| 69 |
];
|
| 70 |
|
| 71 |
function addMarketIntelligenceFilters(command, options = {}) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
if (options.includeMarket !== false) {
|
| 73 |
command.addStringOption((option) =>
|
| 74 |
option
|
|
@@ -79,12 +98,12 @@ function addMarketIntelligenceFilters(command, options = {}) {
|
|
| 79 |
);
|
| 80 |
}
|
| 81 |
|
| 82 |
-
if (options.includeBook) {
|
| 83 |
command.addStringOption((option) =>
|
| 84 |
option
|
| 85 |
.setName('book')
|
| 86 |
.setDescription('Optional book filter.')
|
| 87 |
-
.setRequired(
|
| 88 |
.addChoices(...MARKET_INTELLIGENCE_BOOK_CHOICES)
|
| 89 |
);
|
| 90 |
}
|
|
@@ -98,12 +117,12 @@ function addMarketIntelligenceFilters(command, options = {}) {
|
|
| 98 |
);
|
| 99 |
}
|
| 100 |
|
| 101 |
-
if (options.includePlayer) {
|
| 102 |
command.addStringOption((option) =>
|
| 103 |
option
|
| 104 |
.setName('player')
|
| 105 |
.setDescription('Optional player filter.')
|
| 106 |
-
.setRequired(
|
| 107 |
);
|
| 108 |
}
|
| 109 |
|
|
|
|
| 69 |
];
|
| 70 |
|
| 71 |
function addMarketIntelligenceFilters(command, options = {}) {
|
| 72 |
+
if (options.includeBook && options.bookRequired === true) {
|
| 73 |
+
command.addStringOption((option) =>
|
| 74 |
+
option
|
| 75 |
+
.setName('book')
|
| 76 |
+
.setDescription('Optional book filter.')
|
| 77 |
+
.setRequired(true)
|
| 78 |
+
.addChoices(...MARKET_INTELLIGENCE_BOOK_CHOICES)
|
| 79 |
+
);
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
if (options.includePlayer && options.playerRequired === true) {
|
| 83 |
+
command.addStringOption((option) =>
|
| 84 |
+
option
|
| 85 |
+
.setName('player')
|
| 86 |
+
.setDescription('Optional player filter.')
|
| 87 |
+
.setRequired(true)
|
| 88 |
+
);
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
if (options.includeMarket !== false) {
|
| 92 |
command.addStringOption((option) =>
|
| 93 |
option
|
|
|
|
| 98 |
);
|
| 99 |
}
|
| 100 |
|
| 101 |
+
if (options.includeBook && options.bookRequired !== true) {
|
| 102 |
command.addStringOption((option) =>
|
| 103 |
option
|
| 104 |
.setName('book')
|
| 105 |
.setDescription('Optional book filter.')
|
| 106 |
+
.setRequired(false)
|
| 107 |
.addChoices(...MARKET_INTELLIGENCE_BOOK_CHOICES)
|
| 108 |
);
|
| 109 |
}
|
|
|
|
| 117 |
);
|
| 118 |
}
|
| 119 |
|
| 120 |
+
if (options.includePlayer && options.playerRequired !== true) {
|
| 121 |
command.addStringOption((option) =>
|
| 122 |
option
|
| 123 |
.setName('player')
|
| 124 |
.setDescription('Optional player filter.')
|
| 125 |
+
.setRequired(false)
|
| 126 |
);
|
| 127 |
}
|
| 128 |
|