Q: How can I find a message in a link I was recently creating a bot.
Right now I am trying to find out if someone could help me with my -verify (mc uuid) command. It would check a URL to see if their uuid is in the fetched object. So, if I did -verify (uuid) and it is found, it would give me a role.
Code:
const Discord = require('discord.js');
const fetch = require('cross-fetch');

module.exports = {
    name: `verify`,
    async execute(message, args) {
        fetch("https://api.hypixel.net/guild?key=29083d9d-58cf-4a71-95be-d24f31c018b7&name=Metanoia")
            .then(result => result.json())
            .then(({ guild }) => {
        const role = message.guild.roles.cache.get('808886143416270899');
        const uuid = args[0];
        if(uuid) {
            //
        }
        })
    }
}


A: You receive an object from the API URL. Its guild property has a members array. The array contains objects with uuids. If you want to find one with the provided uuid, you can use the .find() method that returns the value of the first element in the array that satisfies the provided testing function.
In your testing function you can test if the object's uuid is the same as the member provided uuid:
const foundElement = array.find((el) => el.uuid === uuid);

In your code it looks like this:
const fetch = require('cross-fetch');

module.exports = {
  name: `verify`,
  async execute(message, args) {
    const role = message.guild.roles.cache.get('808886143416270899');
    const uuid = args[0];

    if (!uuid) {
      return message.channel.send(`uuid is not provided`);
    }

    try {
      const result = await fetch('https://api.hypixel.net/guild?key=29083d9d-58cf-4a71-95be-d24f31c018b7&name=Metanoia');
      const { guild } = await result.json();
      const member = guild.members.find((member) => member.uuid === uuid);

      if (!member) {
        return message.channel.send(`No member found with uuid ${uuid}`);
      }

      // you can do anything with the found member
      message.channel.send('```' + JSON.stringify(member, null, 2) + '```');
    } catch (error) {
      console.log(error);
      message.channel.send('Oops, there was an error');
    }
  }
}

If your execute method is already an async function, you can use async/await to fetch the results. I used that in my code above.

