This snippet allows you to search Roblox groups by ID throw Discord. It can be useful if you need info about some Roblox group. For more Roblox-related projects check my profile.
// Use this format to trigger: !group [group ID here]
// Authenticates you with the API standard library
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
// Get roblox group ID
let message = context.params.event.content;
let searchString = message.split(' ').slice(1).join(' ');
// Get data for that group ID
let result = await lib.http.request['@1.1.6'].get({
url: `https://groups.roblox.com/v2/groups`,
queryParams: {
groupIds: `${searchString}`,
},
});
// 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: `Search result for ${result.data.data[0].name}`,
description: '',
color: 0x8761fa,
fields: [
{
name: `Group name`,
value: `${result.data.data[0].name}`,
},
{
name: `Group description`,
value: `${result.data.data[0].description}`,
},
{
name: `Group ID`,
value: `${result.data.data[0].id}`,
},
],
},
],
});