amy
amy
DIAdiscord.js - Imagine an app
Created by amy on 7/4/2023 in #djs-questions
Replaying missed events after shutdown
Does d.js expose any way to replay events missed due to a temporary shutdown? The TLDR is that our host will perform automatic relocation for load balancing every so often, and we'd like to replay events missed from this procedure. This would be a full application restart, not just a gateway reconnect, so I'm not sure if it's possible. Here's the gateway docs for this feature https://discord.com/developers/docs/topics/gateway-events#resume. It would be trivial for us to persist the fields required in this request if d.js gives us access (session and sequence information).
14 replies
DIAdiscord.js - Imagine an app
Created by amy on 10/19/2022 in #djs-questions
Using unicode emojis in buttons.
When attempting to use a unicode emoji in a button (using :name: format and the raw emoji), the API returns
"message": "Invalid Form Body\ncomponents[0].components[0].emoji.name[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji\ncomponents[0].components[1].emoji.name[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji\ncomponents[0].components[2].emoji.name[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji"
"message": "Invalid Form Body\ncomponents[0].components[0].emoji.name[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji\ncomponents[0].components[1].emoji.name[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji\ncomponents[0].components[2].emoji.name[BUTTON_COMPONENT_INVALID_EMOJI]: Invalid emoji"
3 replies
DIAdiscord.js - Imagine an app
Created by amy on 7/18/2022 in #djs-questions
Using Modals with CommandInteraction
When attempting to use Modals with interactions (specifically slash commands), tsc is throwing errors..? Code, copy pasted from the guide (both examples)
const modal = new ModalBuilder()
.setCustomId('myModal')
.setTitle('My Modal');

// TODO: Add components to modal...

await interaction.showModal(modal);
const modal = new ModalBuilder()
.setCustomId('myModal')
.setTitle('My Modal');

// TODO: Add components to modal...

await interaction.showModal(modal);
where interaction is a CommandInteraction<'cached'> TS error:
Argument of type 'ModalBuilder' is not assignable to parameter of type 'Modal | ModalOptions'.
Type 'ModalBuilder' is missing the following properties from type 'Modal': customId, title, spliceComponents
Argument of type 'ModalBuilder' is not assignable to parameter of type 'Modal | ModalOptions'.
Type 'ModalBuilder' is missing the following properties from type 'Modal': customId, title, spliceComponents
Tried calling toJSON and accessing the data prop, neither work. Relevant versions:
"@discordjs/builders": "^0.15.0",
"@discordjs/rest": "^0.5.0",
"discord-api-types": "^0.36.1",
"discord.js": "^13.8.1",
"@discordjs/builders": "^0.15.0",
"@discordjs/rest": "^0.5.0",
"discord-api-types": "^0.36.1",
"discord.js": "^13.8.1",
10 replies