mirror of
https://github.com/skylanix/MamieHenriette.git
synced 2026-02-15 12:30:39 +01:00
Legere correctif sur le bot pour proton db
This commit is contained in:
@@ -81,8 +81,7 @@ async def on_message(message: Message):
|
|||||||
else :
|
else :
|
||||||
msg = f'{mention} J\'ai trouvé {len(games)} jeux :\n'
|
msg = f'{mention} J\'ai trouvé {len(games)} jeux :\n'
|
||||||
ite = iter(games)
|
ite = iter(games)
|
||||||
while (game := next(ite, None)) is not None and len(msg) < 1900 :
|
while (game := next(ite, None)) is not None and len(msg) < 1850 :
|
||||||
print(game)
|
|
||||||
msg += f'- [{game.get('name')}](https://www.protondb.com/app/{game.get('id')}) classé **{game.get('tier')}**\n'
|
msg += f'- [{game.get('name')}](https://www.protondb.com/app/{game.get('id')}) classé **{game.get('tier')}**\n'
|
||||||
rest = sum(1 for _ in ite)
|
rest = sum(1 for _ in ite)
|
||||||
if (rest > 0):
|
if (rest > 0):
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
import requests
|
import requests
|
||||||
|
import re
|
||||||
|
|
||||||
from algoliasearch.search.client import SearchClientSync, SearchConfig
|
from algoliasearch.search.client import SearchClientSync, SearchConfig
|
||||||
from database.helpers import ConfigurationHelper
|
from database.helpers import ConfigurationHelper
|
||||||
@@ -24,8 +25,10 @@ def _call_summary(id):
|
|||||||
logging.error(f'{response.status_code} on {id}')
|
logging.error(f'{response.status_code} on {id}')
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _is_name_match(name:str, search_name:str) -> bool:
|
def _is_name_match(name:str, search_name:str) -> bool:
|
||||||
return name.lower().find(search_name.lower()) >= 0
|
normalized_game_name = re.sub("[^a-z0-9]", "", name.lower())
|
||||||
|
normalized_search_name = re.sub("[^a-z0-9]", "", search_name.lower())
|
||||||
|
return normalized_game_name.find(normalized_search_name.lower()) >= 0
|
||||||
|
|
||||||
def searhProtonDb(search_name:str):
|
def searhProtonDb(search_name:str):
|
||||||
results = []
|
results = []
|
||||||
|
|||||||
Reference in New Issue
Block a user