install.bat: fix discord import check for Windows SSL cert store bug

discord.py imports aiohttp which calls ssl.create_default_context() at import
time. A malformed cert in the Windows cert store raises ASN1 NOT_ENOUGH_DATA.
The bot patches this at runtime via _patch_ssl(); the install check now applies
the same workaround (null-patch load_default_certs) so discord: OK on all machines.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
alexpolo1
2026-06-20 00:19:24 +02:00
parent a4e3ff0e2f
commit 41c230ad9c

View File

@@ -327,7 +327,7 @@ if "%OCR_READY%"=="0" (
echo.
echo Verifying all dependencies...
set "ALL_OK=1"
for %%M in (cv2 mss numpy discord transitions rapidfuzz) do (
for %%M in (cv2 mss numpy transitions rapidfuzz) do (
set "PATH=%TESS_PATH%;%PATH%"
"%CONDA_EXE%" run -n botty python -c "import %%M" >nul 2>&1
if !errorlevel! neq 0 (
@@ -337,6 +337,17 @@ for %%M in (cv2 mss numpy discord transitions rapidfuzz) do (
echo %%M: OK
)
)
:: discord.py imports aiohttp which calls ssl.create_default_context() at import
:: time. A malformed cert in the Windows store triggers ASN1 NOT_ENOUGH_DATA.
:: The bot patches this at runtime via _patch_ssl(); check import with the patch.
set "PATH=%TESS_PATH%;%PATH%"
"%CONDA_EXE%" run -n botty python -c "import ssl; ssl.SSLContext.load_default_certs = lambda *a, **kw: None; import discord" >nul 2>&1
if !errorlevel! neq 0 (
echo FAILED: discord
set "ALL_OK=0"
) else (
echo discord: OK
)
if "%OCR_READY%"=="0" set "ALL_OK=0"
if "%ALL_OK%"=="1" (