it capitalizes the first letter of the permission name and remove underscore and replaces with a space, to make it look like original discord permission names. make sure to create the command here => https://autocode.com/tools/discord/command-builder. Thanks!
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
var {member, token} = context.params.event;
let response_type = 'CHANNEL_MESSAGE_WITH_SOURCE';
let description = member.permission_names
.map(
(x) =>
'**`' +
x.charAt(0).toUpperCase() +
x.slice(1).toLowerCase().split('_').join(' ') +
'`**'
)
.join(' • ');
let embeds = [
{
type: 'rich',
title: `Permissions of ${member.user.username}!`,
thumbnail: {
url: `https://cdn.discordapp.com/avatars/${member.user.id}/${member.user.avatar}.png`,
},
description,
footer: {text: `I guess I have given accurate results to you :)`},
},
];
try {
await lib.discord.interactions['@1.0.1'].responses.create({
token,
response_type,
embeds,
});
} catch (e) {
console.error(e.message);
}