Added ephemeral responses for the pasword generator

This commit is contained in:
Raven Scott 2022-09-28 14:48:15 -04:00
parent 7b8a015825
commit 398de1365c
2 changed files with 8 additions and 2 deletions

View File

@ -3,6 +3,7 @@ var generator = require('generate-password');
module.exports = {
name: "password-generator",
private: true,
description: "Generates a random secure password",
options: [{
"name": "length",
@ -24,7 +25,7 @@ module.exports = {
const embed = new EmbedBuilder()
.setColor("#FF0000")
.setTitle("Password Generated!")
.setDescription(password)
.setDescription("Click to reveal: " + "||" + password + "||")
.setTimestamp()
.setFooter({ text: `Requested by ${interaction.user.tag}`, iconURL: `${interaction.user.displayAvatarURL()}` });
interaction.editReply({ embeds: [embed] });

View File

@ -3,8 +3,13 @@ const client = require("../index");
client.on("interactionCreate", async (interaction) => {
// Slash Command Handling
if (interaction.isChatInputCommand()) {
await interaction.deferReply({ ephemeral: false }).catch(() => { });
console.log(interaction )
if (interaction.commandName == "password-generator") {
await interaction.deferReply({ ephemeral: true }).catch(() => { });
} else {
await interaction.deferReply({ ephemeral: false }).catch(() => { });
}
const cmd = client.slashCommands.get(interaction.commandName);
if (!cmd)
return interaction.followUp({ content: "An error has occurred " });