Untitled

mail@pastecode.io avatar
unknown
python
a year ago
4.8 kB
2
Indexable
Never
import nextcord
from nextcord.utils import get
import requests
import json

TOKEN = ""

GuildID = 1040903592707625020  # Change this with your guild ID

bot = nextcord.Client()

robloxCookie = "_|WARNING:-DO-NOT-SHARE-THIS.--Sharing-this-will-allow-someone-to-log-in-as-you-and-to-steal-your-ROBUX-and-items.|_2C140FFD66803CC5C7F996350E94FE31AAAB46C7FB949EFAF773DC62133F9DAA4FB256AAB0BFAAF9272C0A95DB6FD3D5176671539121895E7D0DC891BC4B341978FCA76619F2A27F61D5845123F18421F5D2D59F6CBDD3BCCA7EEC8E1C535A76BFB9DA943A64A857210D17505F8D057E88F6D8D3220E22549D88C466D3493A3710735420CD3F4A35AF028817E07D6356F4733664507F9D06BA2A1F34DBC6D4548ED2C94E58630D1631E020080EF2BF8F71D492E7BAC3763D8DA03AC03B6566649E34AC492B8A1DF8E19CDBDFEE468552819B7B59585D534FD22D272F1404480A2ED4A096F7B959DEB8D6C340EF5E54CA69B9EEA2C5FFEADFB9DE5E4627C2497D0462FD465DDC9B3895CFF9777915A8D150E4183C18276CF7E624F25688E469A2419E13C9733D5091D2E949683B29743A4D51E364F10DD82F485C3C155F5B93836EF505E71610BB0FCD1E0A7C046EC3C7B3F14209921C9821395C8D060AB62B7027463886900821F5DF558330CC9A3F38D93D79B38B51D01B5DC110FC0BC8E62A88B151922B85C83A1DC4EE6F3D5DAF480EB4F2102D10073F529018906EA84A315FECC54903CEB3B324AD49157FDF94B0D6E24887B720B0CA438A79E471486205AC3BCB36"

CSRFToken = ""

headers = {
    'Content-Type':'application/json',
    'x-csrf-token': CSRFToken
    }


cookies={".ROBLOSECURITY": robloxCookie}


colors = {
    "main": 0x030303,
    "error": 0x800000,
    "log": 0x50b7df
}

roleIDs = {
    "admin" : 1120684967534542921
}

def changePrice(id: int, price: int):
    data = {
        "priceConfiguration":{
        "priceInRobux":price}
    }
    request = requests.post(f"https://itemconfiguration.roblox.com/v1/assets/{id}/update-price", headers=headers, cookies=cookies, data=json.dumps(data))
    print(request.status_code)
    
    if request.status_code == 200:
        print("Success!")
        return True
    elif request.status_code == 403:
        CSRFToken = request.headers["x-csrf-token"]
        headers["x-csrf-token"] = CSRFToken
        request = requests.post(f"https://itemconfiguration.roblox.com/v1/assets/{id}/update-price", headers=headers, cookies=cookies, data=json.dumps(data))
        print(request.status_code)
        return True
    else:
        print(request.status_code)
        return False
    

@bot.event
async def on_ready():
    print(f"{bot.user} is now online!")


@bot.slash_command(guild_ids=[GuildID], description="Desc")
async def change(interaction: nextcord.Interaction, id: int, price: int):
    
    emoji = get(interaction.guild.emojis, id=1140222984947240970)
    
    request = changePrice(id, price)
    if request:
        embed = nextcord.Embed(title=f"{emoji} Change Completed!", description=f"Price of asset **{id}** has been changed to **{price}**", color=colors['main'])
        await interaction.response.send_message(embed=embed)
    else:
        embed = nextcord.Embed(title="Error!", description=f"Failed to change price of {id} to {price}!", color=colors['error'])
        await interaction.response.send_message(embed=embed)
        
@ bot.slash_command(guild_ids=[GuildID], description="Calculate the robux tax on a sale.")
async def calculatetax(interaction: nextcord.Interaction, robux: int):
    if robux <= 0:
        await interaction.response.send_message("Please provide a value greater than 0", ephemeral=True)
    else:
        try:
            taxedAmount = round(robux - (0.3 * robux))
            emoji = get(interaction.guild.emojis, id=1140222984947240970)
            embed = nextcord.Embed(title=f"{emoji} Before Tax Amount Calculated", description=f"""
            Initial Amount: {robux}
            Amount with tax covered: {taxedAmount}""", color=colors['main'])
            await interaction.response.send_message(embed=embed, ephemeral=False)
        except:
            pass


@ bot.slash_command(guild_ids=[GuildID], description="Calculate the amount you need to sell an item to get what you want.")
async def sellprice(interaction: nextcord.Interaction, robux: int):
    if robux <= 0:
        await interaction.response.send_message("Please provide a value greater than 0", ephemeral=True)
    else:
        try:
            finalAmount = round((robux * 0.7/0.7/0.7))
            emoji = get(interaction.guild.emojis, id=1140222984947240970)
            embed = nextcord.Embed(title=f"{emoji} After Tax Amount Calculated", description=f"""
            Amount with tax covered: {robux}
            Amount to receive: {finalAmount}""", color=colors['main'])
            await interaction.response.send_message(embed=embed, ephemeral=False)
        except:
            pass
bot.run(TOKEN)