diff --git a/commands/take.js b/commands/take.js index 0dbe1be..17e715f 100644 --- a/commands/take.js +++ b/commands/take.js @@ -38,7 +38,7 @@ async function execute(interaction) { } try { - await buy(info); + await noblox.buy({product: info, price: 0}); await interaction.reply( ` Now that your map (id: ${id}) has been taken by the ${game} maptest bot you can load it into the ${game} maptest place. To load your map, join the game and say @@ -58,39 +58,6 @@ If it did not load successfully, you can expand the chat to view the full error } } } -async function buy (product) { - const productId = product.ProductId; - const httpOpt = { - url: '//economy.roblox.com/v1/purchases/products/' + productId, - options: { - method: 'POST', - jar: undefined, - headers: { - 'X-CSRF-TOKEN': await noblox.getGeneralToken() - }, - json: { - expectedCurrency: 1, - expectedPrice: 0, - expectedSellerId: product.Creator.Id - } - } - }; - - const json = await noblox.http(httpOpt); - console.log(json) - - let err = json.errorMsg - if (json.reason === 'InsufficientFunds') { - err = 'You need ' + json.shortfallPrice + ' more robux to purchase this item.'; - } else if (json.errorMsg) { - err = json.errorMsg; - } - if (!err) { - return productId; - } else { - throw new Error(err); - } -} module.exports = { data: new SlashCommandBuilder()