This snippet allows you to search for the Roblox group by its ID.
// Authenticates you with the API standard library
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
await lib.discord.channels['@0.3.1'].typing.create({
channel_id: `${context.params.event.channel_id}`,
});
// Get string what we will search
let message = context.params.event.content;
let string = parseInt(message.split(' ').slice(1).join(' '));
var result;
try {
// Make API request
var result = await lib.robloxcore.groups['@0.0.1'].search({
groupId: string,
});
let testData = result.name;
} catch (e) {
await lib.discord.channels['@0.3.0'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: ` Unknown error occurred.`,
message_reference: {
message_id: `${context.params.event.id}`,
},
});
return;
}
if (result != undefined) {
let logoGroup = await lib.http.request['@1.1.6'].get({
url: `https://thumbnails.roblox.com/v1/groups/icons?groupIds=${result.id}&size=420x420&format=Png&isCircular=false`,
});
// Create message with all data what Roblox give us back
await lib.discord.channels['@0.3.0'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: ``,
message_reference: {
message_id: `${context.params.event.id}`,
},
embeds: [
{
type: `rich`,
title: `Roblox group search info`,
description: ` Best result for \*${string}\*.`,
color: 0x303136,
fields: [
{
name: `Group name`,
value: `${result.name}`,
},
{
name: `Group description`,
value: result.description || 'No description',
},
{
name: `Group ID`,
value: `${result.id}`,
},
],
thumbnail: {
url: logoGroup.data.data[0].imageUrl,
height: 0,
width: 0,
},
},
],
});
} else {
await lib.discord.channels['@0.3.0'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: ` Unknown error occurred.`,
message_reference: {
message_id: `${context.params.event.id}`,
},
});
}