ravenbotv14/commands/untils/passwordgen.js

34 lines
1010 B
JavaScript
Raw Normal View History

2022-09-25 03:16:54 -04:00
const { EmbedBuilder } = require('discord.js');
2023-01-08 02:50:40 -05:00
const generator = require('generate-password');
2022-09-25 03:16:54 -04:00
module.exports = {
name: "password-generator",
description: "Generates a random secure password",
2022-09-28 17:58:24 -04:00
private: true,
2022-09-25 03:16:54 -04:00
options: [{
2023-01-08 02:50:40 -05:00
name: "length",
description: "Provide a number for how long to make the password.",
required: true,
type: 3 // 6 is type USER
}],
2022-09-25 03:16:54 -04:00
run: async (client, interaction) => {
2023-01-08 02:50:40 -05:00
const { value: length } = interaction.options._hoistedOptions[0];
const password = generator.generate({
length,
2022-09-25 03:16:54 -04:00
numbers: true,
symbols: true,
excludeSimilarCharacters: true
});
const embed = new EmbedBuilder()
.setColor("#FF0000")
.setTitle("Password Generated!")
2023-01-08 02:50:40 -05:00
.setDescription(`Click to reveal: ||${password}||`)
2022-09-25 03:16:54 -04:00
.setTimestamp()
2023-01-08 02:50:40 -05:00
.setFooter({
text: `Requested by ${interaction.user.tag}`,
iconURL: `${interaction.user.displayAvatarURL()}`
});
2022-09-25 03:16:54 -04:00
interaction.editReply({ embeds: [embed] });
2023-01-08 02:50:40 -05:00
}
2022-09-25 03:16:54 -04:00
};