[Python] discord bot error Shard ID None is requesting privileged

Discussão em 'Python' iniciado por Stack, Março 17, 2025.

  1. Stack

    Stack Membro Participativo

    I'm making a discord bot to find cheap cs2 skins. and I keep getting this error.I don't know if it's an API problem or my code problem, I can say that this is my first time making a discord bot.


    [2025-03-17 17:35:34] [INFO ] discord.client: logging in using static token
    Traceback (most recent call last):
    File "C:\Users\yahowa\Desktop\SkinPort İnstaBuy Bot\bot.py", line 83, in <module>
    bot.run('MY BOT TOKEN I DELETED I KNOW THERES NO TOKEN')
    File "C:\Users\yahowa\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 906, in run
    asyncio.run(runner())
    File "C:\Users\yahowa\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
    File "C:\Users\yahowa\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 649, in run_until_complete
    return future.result()
    File "C:\Users\yahowa\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 895, in runner
    await self.start(token, reconnect=reconnect)
    File "C:\Users\yahowa\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 824, in start
    await self.connect(reconnect=reconnect)
    File "C:\Users\yahowa\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 748, in connect
    raise PrivilegedIntentsRequired(exc.shard_id) from None
    discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.



    my code:

    import discord
    import requests
    from discord.ext import commands

    # Bot token ve API anahtarlarını buraya ekleyin
    DISCORD_TOKEN = 'TOKEN'
    WAXPEER_API_KEY = 'TOKEN'
    CSFLOAT_API_KEY = 'TOKEN'
    STEAM_API_KEY = 'TOKEN'

    intents = discord.Intents.all()
    bot = commands.Bot(command_prefix='!', intents=intents)

    # Waxpeer API'den fiyat çekme fonksiyonu
    def get_waxpeer_price(item_name):
    url = f'https://api.waxpeer.com/items/{item_name}'
    params = {'api_key': WAXPEER_API_KEY}
    response = requests.get(url, params=params)
    if response.status_code == 200:
    data = response.json()
    return data['price']
    return None

    # CSFloat API'den fiyat çekme fonksiyonu
    def get_csfloat_price(item_name):
    url = f'https://api.csfloat.com/items/{item_name}'
    params = {'api_key': CSFLOAT_API_KEY}
    response = requests.get(url, params=params)
    if response.status_code == 200:
    data = response.json()
    return data['price']
    return None

    # Steam API'den fiyat çekme fonksiyonu
    def get_steam_price(item_name):
    steam_market_url = 'https://api.steampowered.com/ISteamEconomy/GetAssetPrices/v1/'
    params = {
    'appid': '730', # CS:GO app ID
    'currency': '1', # USD
    'key': STEAM_API_KEY
    }
    response = requests.get(steam_market_url, params=params)
    if response.status_code == 200:
    data = response.json()
    # Steam fiyat bilgilerini burada uygun şekilde çekmek gerekiyor
    return data['response']['prices'][0]['price'] # Örnek bir veri yapısı
    return None

    # Fiyat karşılaştırma ve uygun fiyatları gösterme fonksiyonu
    def compare_prices(waxpeer_price, csfloat_price, steam_price, item_name):
    buff163_discount = steam_price * 0.9 # %90 fiyatı belirle

    results = []
    if waxpeer_price and waxpeer_price < buff163_discount:
    results.append(f"WAXPEER: {item_name} fiyatı uygun: {waxpeer_price} USD")

    if csfloat_price and csfloat_price < buff163_discount:
    results.append(f"CSFLOAT: {item_name} fiyatı uygun: {csfloat_price} USD")

    if steam_price and steam_price < buff163_discount:
    results.append(f"STEAM: {item_name} fiyatı uygun: {steam_price} USD")

    if not results:
    return f"{item_name} için uygun fiyat bulunamadı!"

    return '\n'.join(results)

    # Discord komutu ile fiyat karşılaştırmasını yapma
    @bot.command()
    async def compare(ctx, *, item_name: str):
    # API'den fiyatları al
    waxpeer_price = get_waxpeer_price(item_name)
    csfloat_price = get_csfloat_price(item_name)
    steam_price = get_steam_price(item_name)

    # Fiyatları karşılaştır
    result = compare_prices(waxpeer_price, csfloat_price, steam_price, item_name)

    # Sonucu Discord kanalına gönder
    await ctx.send(result)

    # Botu çalıştır
    bot.run('MY BOTS TOKEN')




    i also opened this thing Message Content Intent

    i asked gpt too btw. And it always says "open the message content intent!" i said i opened but... doesn't listen.

    Continue reading...

Compartilhe esta Página