Advertisement
lord_shadow

Random password Old Code

Nov 20th, 2022
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const axios = require('axios');
  2. const { MessageEmbed } = require('discord.js');
  3. const Discord = require('discord.js');
  4. const path = require('path');
  5. const discord = require('discord.js');
  6. require('dotenv').config();
  7.  
  8. const config = {
  9.     description: 'Sends a random password.',
  10.     aliases: [],
  11.     usage: '',
  12.     rolesRequired: ['Verified'],
  13.     category: 'Fun',
  14.     slashOption: []
  15. }
  16.  
  17. module.exports = {
  18.     config,
  19.     run: async (client, message, args) => {
  20.         const facts = 'https://no-api-key.com/api/v2/password?length=16';
  21.  
  22.     const errorEmbed = new MessageEmbed()
  23.     .setTitle('Error!')
  24.     .setColor(client.config.colors.error)
  25.     .setDescription('An error occured, please try again!')
  26.     .setTimestamp();
  27.  
  28.         let fact; let
  29.             responses;
  30.         try {
  31.  
  32.             responses = await axios.get(facts);
  33.             fact = responses.data;
  34.         } catch (e) {
  35.             return message.reply({ embeds: [errorEmbed] });
  36.         }
  37.  
  38.         const embed = new MessageEmbed()
  39.             .setTitle('Random Password')
  40.             .setColor(client.config.colors.success)
  41.             .setDescription(fact.password)
  42.  
  43.         return message.channel.send({ embeds: [embed] });
  44.     },
  45.  
  46.   runInteraction: async (client, interaction, args) => {
  47.     const facts = 'https://no-api-key.com/api/v2/password?length=16';
  48.  
  49.     const errorEmbed = new MessageEmbed()
  50.     .setTitle('Error!')
  51.     .setColor(client.config.colors.error)
  52.     .setDescription('An error occured, please try again!')
  53.     .setTimestamp();
  54.  
  55.         let fact; let
  56.             responses;
  57.         try {
  58.  
  59.             responses = await axios.get(facts);
  60.             fact = responses.data;
  61.         } catch (e) {
  62.             return interaction.reply({ embeds: [errorEmbed] });
  63.         }
  64.  
  65.         const embed = new MessageEmbed()
  66.             .setTitle('Random Password')
  67.             .setColor(client.config.colors.success)
  68.             .setDescription(fact.password)
  69.  
  70.         return interaction.reply({ embeds: [embed] });
  71.   }
  72. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement