oneyz_
oneyz_
Explore posts from servers
DIAdiscord.js - Imagine a boo! 👻
Created by oneyz_ on 1/9/2024 in #djs-questions
Edit embed in DM
Hi, I've already written on the djs-help-v14 channel and received a hint on how I can edit the embed using interaction.update({ components: [] }), but I still don't know how to do it, and I'm out of ideas. I want to achieve the following effect: When sending a private message to the user with information that they have received a warning (message in an embed), it also creates a button for an appeal in the embed. After clicking the button, it creates a modal. I want the embed in the private message to be updated after sending the modal (so that the appeal button is removed or set to .setDisabled(true) after successfully sending the modal [isModalSubmit]). Class 'interactionCreate':
if (interaction.isModalSubmit()) {
if (interaction.customId === "modal") {
const fields = interaction.fields.fields;
const administratorNameInput = fields.get("administrator-name-input").value;
const appealDescription = fields.get("appeal-description").value;
const incidentDate = fields.get("incidentDate").value;
const guild = interaction.guild || await client.guilds.fetch(config.guildID);

if (guild) {
const guildChannelId = config.guildChannelId;
const guildChannel = guild.channels.cache.get(guildChannelId);

if (guildChannel) {
guildChannel.send(`INPUT1: ${administratorNameInput}\nINPUT2: ${appealDescription}\nUser: ${interaction.user.tag} (<@${interaction.user.id}>)\nDate: ${incidentDate}`);
interaction.deferUpdate();
} else {
console.error("<interactionCreate.js:60>");
}
} else {
console.error("<interactionCreate.js:60>");
}
}
}
if (interaction.isModalSubmit()) {
if (interaction.customId === "modal") {
const fields = interaction.fields.fields;
const administratorNameInput = fields.get("administrator-name-input").value;
const appealDescription = fields.get("appeal-description").value;
const incidentDate = fields.get("incidentDate").value;
const guild = interaction.guild || await client.guilds.fetch(config.guildID);

if (guild) {
const guildChannelId = config.guildChannelId;
const guildChannel = guild.channels.cache.get(guildChannelId);

if (guildChannel) {
guildChannel.send(`INPUT1: ${administratorNameInput}\nINPUT2: ${appealDescription}\nUser: ${interaction.user.tag} (<@${interaction.user.id}>)\nDate: ${incidentDate}`);
interaction.deferUpdate();
} else {
console.error("<interactionCreate.js:60>");
}
} else {
console.error("<interactionCreate.js:60>");
}
}
}
6 replies