Skip to content

Instantly share code, notes, and snippets.

@sell
Created September 24, 2020 05:49
Show Gist options
  • Save sell/c07857737a325d5a3357098554d12b76 to your computer and use it in GitHub Desktop.
Save sell/c07857737a325d5a3357098554d12b76 to your computer and use it in GitHub Desktop.
Discord Instagram Stats, I decided to clear my github profile up, so I put this in a gist.
const axios = require('axios')
const { MessageEmbed } = require('discord.js');
module.exports = {
name: "ig",
run: async (client, message, args) => {
if (!args[0]) {
return message.channel.send(`Please Enter a Channel Name`)
}
let url, response, account, details;
try {
url = `https://instagram.com/${args[0]}/?__a=1`;
response = await axios.get(url)
account = response.data
details = account.graphql.user
} catch (error) {
return message.channel.send(`Not A Account`)
}
const embed = new MessageEmbed()
.setTitle(`${details.is_verified ? `${details.username} <a:verified:727820439497211994>` : ` ${details.username}`} ${details.is_private ? '🔒' : ''} `)
.setDescription(details.biography)
.setThumbnail(details.profile_pic_url)
.addFields(
{
name: "Total Posts:",
value: details.edge_owner_to_timeline_media.count,
inline: true
},
{
name: "Followers:",
value: details.edge_followed_by.count,
inline: true
},
{
name: "Following:",
value: details.edge_follow.count,
inline: true
}
)
message.channel.send(embed)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment