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')
我也打开了这个东西Message内容意图 我问gpt to btw。它总是说“打开消息内容意图!”我说我打开了,但是...不听。
我有类似的问题
[2025-03-18 15:26:36] [INFO ] discord.client: logging in using static token
Traceback (most recent call last):
File "C:/Users/Валера/Desktop/Bot_DS/Bot.py", line 15, in <module>
bot.run(settings['token']) # Обращаемся к словарю settings с ключом token, для получения токена.
File "C:\Users\Валера\AppData\Local\Programs\Python\Python313\Lib\site-packages\discord\client.py", line 906, in run
asyncio.run(runner())
File "C:\Users\Валера\AppData\Local\Programs\Python\Python313\Lib\asyncio\runners.py", line 195, in run
return runner.run(main)
File "C:\Users\Валера\AppData\Local\Programs\Python\Python313\Lib\asyncio\runners.py", line 118, in run
return self._loop.run_until_complete(task)
File "C:\Users\Валера\AppData\Local\Programs\Python\Python313\Lib\asyncio\base_events.py", line 725, in run_until_complete
return future.result()
File "C:\Users\Валера\AppData\Local\Programs\Python\Python313\Lib\site-packages\discord\client.py", line 895, in runner
await self.start(token, reconnect=reconnect)
File "C:\Users\Валера\AppData\Local\Programs\Python\Python313\Lib\site-packages\discord\client.py", line 824, in start
await self.connect(reconnect=reconnect)
File "C:\Users\Валера\AppData\Local\Programs\Python\Python313\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.
import discord
from discord.ext import commands
from confing import settings
bot = commands.Bot(command_prefix = settings['prefix'],intents=discord.Intents.all());
@bot.command()
async def hello(ctx):
author = ctx.message.author
await ctx.send(f'Hello, {author.mention}!')
bot.run(settings['token'])