Get info about any bot on bot.gg! Use the command !botgg followed by the bot ID you want to check.
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
let id = context.params.event.content.replace('!botgg ', '');
//Use !botgg {{BOT ID}}
try {
let info = await lib.botgg.bots['@0.0.3'].retrieve({
client_id: id,
app_platform: 'discord',
});
console.log(info);
let description = info.full_description
if (info.full_description.includes('')) {
description = description.replace(/<\/strong>/g, '**');
description = description.replace(//g, '**');
}
if (info.full_description.includes('')) {
description = description.replace(/<\/code>/g, '\`');
description = description.replace(//g, '\`');
}
if (info.full_description.includes('* ')) {
description = description.replace(/\* /g, '> ');
}
if (info.tags.length === 0) {
await lib.discord.channels['@0.3.1'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: ``,
embeds: [
{
author: {name: info.bot_username, icon_url: info.full_avatar_url},
description: `${info.short_description}\n\n**--------------------**\n\n${description}\n\n**Server Count:** ${info.server_count}\n**User Count:** ${info.member_count}\n**Views:** ${info.views_count}\n**Upvotes:** ${info.upvotes_count}`,
color: 0x13112c,
image: {url: info.cover_image},
thumbnail: {url: info.full_avatar_url},
footer: {
text: `By ` + info.author.display_name,
icon_url: info.author.full_avatar_url,
},
},
],
});
} else {
let tags = info.tags.map((t) => ({
label: t.label,
style: 1,
custom_id: info.client_id + `_` + t.label,
type: 2
})
);
await lib.discord.channels['@0.3.1'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: ``,
embeds: [
{
author: {name: info.bot_username, icon_url: info.full_avatar_url},
description: `${info.short_description}\n\n**--------------------**\n\n${description}\n\n**Server Count:** ${info.server_count}\n**User Count:** ${info.member_count}\n**Views:** ${info.views_count}\n**Upvotes:** ${info.upvotes_count}`,
color: 0x13112c,
image: {url: info.cover_image},
thumbnail: {url: info.full_avatar_url},
footer: {
text: `By ` + info.author.display_name,
icon_url: info.author.full_avatar_url,
},
},
],
components: [{
type: 1,
components: tags
}]
});
}
} catch (e) {
await lib.discord.channels['@0.3.1'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `No bot found with the ID: \`${id}\``
});
}