I’m new to javascript and I was wondering how I would access the hash value and return the string so I can log it? Here’s my code, I’m using axios.
Here’s my code:
client.on("messageCreate", (message) => {
const args = message.content.slice(prefix.length).trim().split(' ')
const command = args.shift().toLowerCase();
if (command === 'search') {
let termargs = args.join(" ");
const options = {
method: 'GET',
url: 'https://breachdirectory.p.rapidapi.com/',
params: { func: 'auto', term: termargs},
headers: {
'x-rapidapi-host': 'breachdirectory.p.rapidapi.com',
'x-rapidapi-key': (keytouse, keys[keytouse]),
}
};
message.reply("searching...")
options.params.term = termargs
axios.request(options).then(function (response) {
console.log('Found:' , response.data["result"]);
}).catch(function (error) {
message.reply(JSON.stringify(error));
});
}
});
client.login(TOKEN);
Here’s what it returns:
Found:
[
{ has_password: false, sources: [ 'Pluto.tv' ] },
{
has_password: true,
password: 'bleh',
hash: 'kMUX9351bsMjbgXH9rpKKf+GIYJrJy4=',
sources: [ 'Aptoide.com' ]
},
{
has_password: true,
password: 'blah',
hash: 'lEiyXSecP9cIGJfyYhs8yteVEplUIRjAvaI7Jc76upI=',
sources: [ 'Collection 1' ]
},
{
has_password: true,
password: 'blahblahblah',
hash: 'djdrICyb/EfH6+R0g/26+d+GIYJrJy6j',
sources: 'Unverified'
}
]
I tried doing response.data.results.hash but that didn’t work. Any help would be appreciated. Thank you!