@echo off chcp 65001 >nul echo ======================================== echo PostgreSQL 数据库配置助手 echo ======================================== echo. echo 这个脚本将帮助你配置 Discord Bot 所需的数据库 echo. echo 请确保: echo 1. PostgreSQL 已安装并正在运行 echo 2. 你知道 postgres 用户的密码 echo. pause echo. echo 正在打开 SQL Shell... echo 请在打开的窗口中输入 postgres 用户的密码 echo 然后执行以下命令: echo. echo CREATE USER discord_bot WITH PASSWORD 'change_me_strong_password'; echo CREATE DATABASE fan_bot OWNER discord_bot; echo GRANT ALL PRIVILEGES ON DATABASE fan_bot TO discord_bot; echo \q echo. echo ======================================== echo. REM 尝试找到 psql 的路径 where psql >nul 2>&1 if %errorlevel% equ 0 ( echo 启动 SQL Shell... start "" cmd /k "psql -U postgres" ) else ( echo 未找到 psql,请手动打开 SQL Shell (psql) echo 通常在开始菜单中可以找到 pause start "" "C:\Program Files\PostgreSQL\18\bin\psql.exe" -U postgres ) echo. echo 完成数据库配置后,运行 test_db.py 测试连接 echo. pause