const { SlashCommandBuilder } = require('@discordjs/builders'); const noblox = require('noblox.js'); const fetch = require('node-fetch'); const { promisify } = require('util'); const wait = promisify(setTimeout); const Group_ID = '33293764'; const GamePassIDs = ['15155201012', '15155216761', '15155222428']; async function updateGamePassPrices() { try { console.log('Updating game pass prices'); while (true) { try { const gamePassPrices = await Promise.all(GamePassIDs.map(async id => { try { const gamePassInfo = await noblox.getGamePassInfo(Group_ID, id); return { id, price: gamePassInfo.PriceInRobux }; } catch (error) { console.error(`Error fetching game pass ${id} info:`, error); return { id, price: 'N/A' }; } })); console.log('Game Pass Prices:', gamePassPrices); } catch (error) { console.error('Error fetching game pass prices:', error); } await wait(1 * 60 * 1000); } } catch (err) { console.error('Error in updateGamePassPrices:', err); } } module.exports = { data: new SlashCommandBuilder() .setName('gamepass') .setDescription('Edit a game pass price') .addIntegerOption(option => option.setName('passindex') .setDescription('Select the game pass to edit (1, 2, 3)') .setRequired(true) ) .addIntegerOption(option => option.setName('newprice') .setDescription('Enter the new price for the game pass') .setRequired(true) ), async execute(interaction) { const cookie = process.env.Cookie; if (!cookie) { console.error('ROBLOX_COOKIE environment variable is not set.'); await interaction.reply('An error occurred while processing your request.'); return; } try { await noblox.setCookie(cookie); console.log('Logged into noblox'); const passIndex = interaction.options.getInteger('passindex'); const newPrice = interaction.options.getInteger('newprice'); if (passIndex < 1 || passIndex > GamePassIDs.length) { await interaction.reply('Invalid game pass index.'); return; } const gamePassID = GamePassIDs[passIndex - 1]; const response = await fetch(`https://groups.roblox.com/v1/groups/${Group_ID}/games/pass/${gamePassID}`, { method: 'PATCH', headers: { 'Content-Type': 'application/json', 'Cookie': `.ROBLOSECURITY=${cookie}` }, body: JSON.stringify({ price: newPrice }) }); if (response.ok) { await interaction.reply(`Game pass ${passIndex} price updated to ${newPrice} Robux.`); } else { console.error('Error updating game pass price:', response.statusText); await interaction.reply('An error occurred while updating the game pass price.'); } } catch (error) { console.error('Error setting up noblox:', error); await interaction.reply('An error occurred while processing your request.'); } }, }; updateGamePassPrices();