mirror of
https://github.com/skylanix/MamieHenriette.git
synced 2026-02-06 06:40:35 +01:00
test proton db...
This commit is contained in:
@@ -52,7 +52,11 @@ class DiscordBot(discord.Client):
|
||||
logging.info('Humble bundle est désactivé')
|
||||
# toute les 30 minutes
|
||||
await asyncio.sleep(30*60)
|
||||
|
||||
|
||||
# TODO voir ce que je prend
|
||||
def event(self, coro):
|
||||
return super().event(coro)
|
||||
|
||||
def begin(self) :
|
||||
token = Configuration.query.filter_by(key='discord_token').first()
|
||||
if token :
|
||||
@@ -63,3 +67,10 @@ class DiscordBot(discord.Client):
|
||||
intents = discord.Intents.default()
|
||||
bot = DiscordBot(intents=intents)
|
||||
|
||||
# TODO voir ce que je prend
|
||||
@bot.event
|
||||
async def on_message(message):
|
||||
if message.channel.id == 1234567:
|
||||
@bot.command()
|
||||
async def name(ctx, arg):
|
||||
await ctx.send(f"hello {arg}")
|
||||
|
||||
36
protondb/__init__.py
Normal file
36
protondb/__init__.py
Normal file
@@ -0,0 +1,36 @@
|
||||
|
||||
import requests
|
||||
from algoliasearch.search.client import SearchClientSync, SearchConfig, RequestOptions
|
||||
|
||||
app_id = "94HE6YATEI"
|
||||
api_key = "9ba0e69fb2974316cdaec8f5f257088f"
|
||||
|
||||
search_name = "call of duty"
|
||||
|
||||
|
||||
config = SearchConfig(app_id, api_key)
|
||||
config.set_default_hosts()
|
||||
client = SearchClientSync(app_id, api_key, config=config)
|
||||
options = RequestOptions(config=config, headers={'referers':'https://www.protondb.com/'})
|
||||
responses = client.search_single_index(index_name="steamdb",
|
||||
search_params={
|
||||
"query":"call of duty",
|
||||
"facetFilters":[["appType:Game"]],
|
||||
"hitsPerPage":50},
|
||||
request_options= {'headers':{'Referer':'https://www.protondb.com/'}})
|
||||
for hit in responses.model_dump().get('hits'):
|
||||
id = hit.get('object_id')
|
||||
name:str = hit.get('name')
|
||||
if (name.lower().find(search_name.lower())>=0) :
|
||||
try:
|
||||
response = requests.get(f'http://jazzy-starlight-aeea19.netlify.app/api/v1/reports/summaries/{id}.json')
|
||||
if (response.status_code == 200) :
|
||||
summmary = response.json()
|
||||
tier = summmary.get('tier')
|
||||
print(f'{name} : {tier}')
|
||||
else :
|
||||
print(f'{response.status_code} on {name}({id})')
|
||||
except Exception as e:
|
||||
print(f'error on {name}({id}): {e}')
|
||||
else:
|
||||
print(f'{name}({id} ne contient pas {search_name})')
|
||||
@@ -1,10 +1,18 @@
|
||||
discord.py==2.3.2
|
||||
python-dotenv==1.0.0
|
||||
# necessaire pour discord.py
|
||||
|
||||
# necessaire pour l'api discord
|
||||
discord.py==2.3.2
|
||||
aiohttp>=3.7.4,<4
|
||||
audioop-lts; python_version>='3.13'
|
||||
|
||||
# necessaire pour l'hebergement du site web
|
||||
flask>=2.3.2
|
||||
flask-sqlalchemy>=3.0.3
|
||||
waitress>=3.0.2
|
||||
requests>=2.32.4
|
||||
|
||||
# necessaire pour l'appel à l'api humble bundle
|
||||
requests>=2.32.4
|
||||
|
||||
# necessaire pour l'appel à protopn db
|
||||
algoliasearch>=4,<5
|
||||
|
||||
|
||||
Reference in New Issue
Block a user