Skip to content

Instantly share code, notes, and snippets.

@eggs-florentine
Last active June 13, 2024 05:39
Show Gist options
  • Save eggs-florentine/b10adda42b8217341bbcea4fe95f5812 to your computer and use it in GitHub Desktop.
Save eggs-florentine/b10adda42b8217341bbcea4fe95f5812 to your computer and use it in GitHub Desktop.
// npm i axios before doing this but i assume u already have
const axios = require('axios');
// options for user id request
const uidOptions = {
method: 'POST',
url: 'https://users.roblox.com/v1/usernames/users',
data: {
'usernames': [
// gets the display name from the designer who sent in the log
interaction.guild.members.cache.get(message.embeds[0].fields[0].value.slice(2, message.embeds[0].fields[0].value.length - 2)).displayName
],
'excludeBannedUsers': false
}
}
// requests userid for payout request
const userid = await axios.request(uidOptions).then(function (response) {
return response.data.data[0].id;
}).catch(function (error) {
console.log(error);
interaction.reply({content: 'The user could not be found! Are you sure the designer has their discord nickname set to their ROBLOX display name?'}, ephemeral: true});
return;
});
// options for payout request
const options = {
method: 'POST',
url: 'http://groups.roblox.com/v1/groups/ILE GROUP ID/payouts',
headers: {
cookie: 'ROBLOSECURITY OF MANAGEMENT ACCOUNT',
'Content-Type': 'application/json',
'User-Agent': 'insomnia/8.6.1',
'x-csrf-token': 'mdUk29CXJBYS'
},
data: {
PayoutType: 1,
Recipients: [
{
recipientId: userid,
recipientType: 0,
amount: interaction.message.embeds[0].fields[4].value.split(' ')[0]
}
]
}
};
// payout request
axios.request(options).then(function (response) {
res = response;
return;
}).catch(function (error) {
res = error.response;
// renew x-csrf token
options.headers['x-csrf-token'] = res.headers['x-csrf-token'];
axios.request(options).then(function (response) {
interaction.reply({content: `Successfully paid out that designer.`, ephemeral: true});
return;
}).catch(function (error) {
// handle error
console.log(error);
console.log(error.response.data.errors);
interaction.reply({content: 'An error has occurred!\n\n' + error, ephemeral: true});
return;
})
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment