@tritard/waterbrother 0.16.150 → 0.16.152
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/README.md +2 -0
- package/package.json +1 -1
- package/src/discord.js +15 -7
package/README.md
CHANGED
|
@@ -185,6 +185,8 @@ waterbrother onboarding
|
|
|
185
185
|
waterbrother update
|
|
186
186
|
```
|
|
187
187
|
|
|
188
|
+
If you are using Discord and want native slash commands to appear immediately in one server, set `channels.discord.guildId` before running `waterbrother discord sync-commands`.
|
|
189
|
+
|
|
188
190
|
Web research examples:
|
|
189
191
|
|
|
190
192
|
```bash
|
package/package.json
CHANGED
package/src/discord.js
CHANGED
|
@@ -1589,13 +1589,21 @@ async function handleDiscordSlashInteraction(runtime, interaction, { log = () =>
|
|
|
1589
1589
|
|
|
1590
1590
|
async function handleDiscordAutocompleteInteraction(runtime, interaction, { log = () => {} } = {}) {
|
|
1591
1591
|
const discord = normalizeDiscordRuntime(runtime);
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1592
|
+
try {
|
|
1593
|
+
const state = await loadDiscordGatewayState();
|
|
1594
|
+
const choices = await buildDiscordAutocompleteChoices(runtime, state, interaction);
|
|
1595
|
+
await createInteractionResponse(discord, interaction, {
|
|
1596
|
+
type: 8,
|
|
1597
|
+
data: { choices }
|
|
1598
|
+
});
|
|
1599
|
+
log(`discord: autocomplete reply in ${String(interaction?.channel_id || "").trim()}`);
|
|
1600
|
+
} catch (error) {
|
|
1601
|
+
await createInteractionResponse(discord, interaction, {
|
|
1602
|
+
type: 8,
|
|
1603
|
+
data: { choices: [] }
|
|
1604
|
+
}).catch(() => null);
|
|
1605
|
+
throw error;
|
|
1606
|
+
}
|
|
1599
1607
|
}
|
|
1600
1608
|
|
|
1601
1609
|
async function buildDiscordAbout(runtime, state, message) {
|