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

View File

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