diff --git a/commands/untils/passwordgen.js b/commands/untils/passwordgen.js new file mode 100644 index 0000000..ab33fc8 --- /dev/null +++ b/commands/untils/passwordgen.js @@ -0,0 +1,32 @@ +const { EmbedBuilder } = require('discord.js'); +var generator = require('generate-password'); + +module.exports = { + name: "password-generator", + description: "Generates a random secure password", + options: [{ + "name": "length", + "description": "Provide a number for how long to make the password.", + "required": true, + "type": 3 // 6 is type USER +}], + + run: async (client, interaction) => { + let length = interaction.options._hoistedOptions[0].value + + var password = generator.generate({ + length: length, + numbers: true, + symbols: true, + excludeSimilarCharacters: true + }); + + const embed = new EmbedBuilder() + .setColor("#FF0000") + .setTitle("Password Generated!") + .setDescription(password) + .setTimestamp() + .setFooter({ text: `Requested by ${interaction.user.tag}`, iconURL: `${interaction.user.displayAvatarURL()}` }); + interaction.editReply({ embeds: [embed] }); + }, +}; diff --git a/package-lock.json b/package-lock.json index d8f4ca7..2a6f626 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,7 @@ "discord.js": "^14.0.3", "dotenv": "^16.0.0", "download-file": "^0.1.5", + "generate-password": "^1.7.0", "give-me-a-joke": "^0.5.1", "glob": "^7.2.0", "is-not-defined": "^1.0.1", @@ -615,6 +616,11 @@ "node": ">=10" } }, + "node_modules/generate-password": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/generate-password/-/generate-password-1.7.0.tgz", + "integrity": "sha512-WPCtlfy0jexf7W5IbwxGUgpIDvsZIohbI2DAq2Q6TSlKKis+G4GT9sxvPxrZUGL8kP6WUXMWNqYnxY6DDKAdFA==" + }, "node_modules/getpass": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", @@ -1975,6 +1981,11 @@ "wide-align": "^1.1.2" } }, + "generate-password": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/generate-password/-/generate-password-1.7.0.tgz", + "integrity": "sha512-WPCtlfy0jexf7W5IbwxGUgpIDvsZIohbI2DAq2Q6TSlKKis+G4GT9sxvPxrZUGL8kP6WUXMWNqYnxY6DDKAdFA==" + }, "getpass": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", diff --git a/package.json b/package.json index b32f5e7..4f59697 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "discord.js": "^14.0.3", "dotenv": "^16.0.0", "download-file": "^0.1.5", + "generate-password": "^1.7.0", "give-me-a-joke": "^0.5.1", "glob": "^7.2.0", "is-not-defined": "^1.0.1",