From 464180e148a5770c07642ed26f2b07cc8a036f27 Mon Sep 17 00:00:00 2001 From: Kepka Ludovic Date: Fri, 22 Aug 2025 07:13:08 +0200 Subject: [PATCH 1/3] Erreur d'authentification twitch --- twitchbot/__init__.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/twitchbot/__init__.py b/twitchbot/__init__.py index 963c1d7..cecdedd 100644 --- a/twitchbot/__init__.py +++ b/twitchbot/__init__.py @@ -33,15 +33,18 @@ class TwitchBot() : async def _connect(self): with webapp.app_context(): if _isConfigured() : - helper = ConfigurationHelper() - self.twitch = await Twitch(helper.getValue('twitch_client_id'), helper.getValue('twitch_client_secret')) - await self.twitch.set_user_authentication(helper.getValue('twitch_access_token'), USER_SCOPE, helper.getValue('twitch_refresh_token')) - self.chat = await Chat(self.twitch) - self.chat.register_event(ChatEvent.READY, _onReady) - self.chat.register_event(ChatEvent.MESSAGE, _onMessage) - # chat.register_event(ChatEvent.SUB, on_sub) - self.chat.register_command('hello', _helloCommand) - self.chat.start() + try : + helper = ConfigurationHelper() + self.twitch = await Twitch(helper.getValue('twitch_client_id'), helper.getValue('twitch_client_secret')) + await self.twitch.set_user_authentication(helper.getValue('twitch_access_token'), USER_SCOPE, helper.getValue('twitch_refresh_token')) + self.chat = await Chat(self.twitch) + self.chat.register_event(ChatEvent.READY, _onReady) + self.chat.register_event(ChatEvent.MESSAGE, _onMessage) + # chat.register_event(ChatEvent.SUB, on_sub) + self.chat.register_command('hello', _helloCommand) + self.chat.start() + except Exception as e: + logging.error(f'twitch auth error {e}') else: logging.info("Twitch is not configured") From f772f3cace1a56980b5d6d1d81b4cd02438bc28a Mon Sep 17 00:00:00 2001 From: Kepka Ludovic Date: Fri, 22 Aug 2025 07:28:14 +0200 Subject: [PATCH 2/3] message plus explicite --- twitchbot/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/twitchbot/__init__.py b/twitchbot/__init__.py index cecdedd..ba56839 100644 --- a/twitchbot/__init__.py +++ b/twitchbot/__init__.py @@ -44,7 +44,7 @@ class TwitchBot() : self.chat.register_command('hello', _helloCommand) self.chat.start() except Exception as e: - logging.error(f'twitch auth error {e}') + logging.error(f'twitch auth error, check your ids and restart after correction {e}') else: logging.info("Twitch is not configured") From 07719923b3c88b3d3e8e8e2f4c56a10b2004a6e4 Mon Sep 17 00:00:00 2001 From: skylanix Date: Fri, 22 Aug 2025 13:34:49 +0200 Subject: [PATCH 3/3] =?UTF-8?q?Log=20en=20fran=C3=A7ais?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- discordbot/__init__.py | 6 +++--- discordbot/humblebundle.py | 4 ++-- protondb/__init__.py | 4 ++-- twitchbot/__init__.py | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/discordbot/__init__.py b/discordbot/__init__.py index e0255f2..0c34de8 100644 --- a/discordbot/__init__.py +++ b/discordbot/__init__.py @@ -41,7 +41,7 @@ class DiscordBot(discord.Client): if token : self.run(token.value) else : - logging.error('pas de token on ne lance pas discord') + logging.error('Aucun token Discord configuré. Le bot ne peut pas être démarré') intents = discord.Intents.default() intents.message_content = True @@ -61,7 +61,7 @@ async def on_message(message: Message): await message.channel.send(commande.response, suppress_embeds=True) return except Exception as e: - logging.error(e) + logging.error(f'Échec de l\'exécution de la commande Discord : {e}') if(ConfigurationHelper().getValue('proton_db_enable_enable') and message.content.find('!protondb')==0) : if (message.content.find('<@')>0) : @@ -83,5 +83,5 @@ async def on_message(message: Message): try : await message.channel.send(msg, suppress_embeds=True) except Exception as e: - logging.error(e) + logging.error(f'Échec de l\'envoi du message ProtonDB : {e}') diff --git a/discordbot/humblebundle.py b/discordbot/humblebundle.py index 1d32ee7..430b61b 100644 --- a/discordbot/humblebundle.py +++ b/discordbot/humblebundle.py @@ -16,7 +16,7 @@ def _callHexas(): response = requests.get("http://hexas.shionn.org/humble-bundle/json", headers={ "Content-Type": "application/json" }) if response.status_code == 200: return response.json() - logging.error(f"Erreur de connexion {response.status_code}") + logging.error(f"Échec de la connexion à l'API Humble Bundle. Code de statut HTTP : {response.status_code}") return None def _isNotAlreadyNotified(bundle): @@ -41,7 +41,7 @@ async def checkHumbleBundleAndNotify(bot: Client): db.session.add(GameBundle(id=bundle['id'], name=bundle['name'], json = json.dumps(bundle))) db.session.commit() except Exception as e: - logging.error(f"Erreur de connexion {e}") + logging.error(f"Échec de la vérification des offres Humble Bundle : {e}") else: logging.info('Humble Bundle est désactivé') diff --git a/protondb/__init__.py b/protondb/__init__.py index e66f35e..32aa33d 100644 --- a/protondb/__init__.py +++ b/protondb/__init__.py @@ -22,7 +22,7 @@ def _call_summary(id): response = requests.get(f'http://jazzy-starlight-aeea19.netlify.app/api/v1/reports/summaries/{id}.json') if (response.status_code == 200) : return response.json() - logging.error(f'{response.status_code} on {id}') + logging.error(f'Échec de la récupération des données ProtonDB pour le jeu {id}. Code de statut HTTP : {response.status_code}') return None def _is_name_match(name:str, search_name:str) -> bool: @@ -48,7 +48,7 @@ def searhProtonDb(search_name:str): }) logging.info(f'found {name}({id} : {tier}') except Exception as e: - logging.error(f'error on {name}({id}): {e}') + logging.error(f'Erreur lors du traitement du jeu {name} (ID: {id}) : {e}') else: logging.info(f'{name}({id} ne contient pas {search_name})') return results diff --git a/twitchbot/__init__.py b/twitchbot/__init__.py index ba56839..9c0f3ad 100644 --- a/twitchbot/__init__.py +++ b/twitchbot/__init__.py @@ -44,9 +44,9 @@ class TwitchBot() : self.chat.register_command('hello', _helloCommand) self.chat.start() except Exception as e: - logging.error(f'twitch auth error, check your ids and restart after correction {e}') + logging.error(f'Échec de l\'authentification Twitch. Vérifiez vos identifiants et redémarrez après correction : {e}') else: - logging.info("Twitch is not configured") + logging.info("Twitch n'est pas configuré") def begin(self): asyncio.run(self._connect())