功能:实现 Danding_Points 积分系统插件
- 新增积分系统插件,支持积分查询、签到、转账等核心功能 - 包含对应的测试脚本 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
27
danding_bot/plugins/danding_points/config.py
Normal file
27
danding_bot/plugins/danding_points/config.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from pydantic import BaseSettings, validator
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
class Config(BaseSettings):
|
||||
"""Points system configuration."""
|
||||
|
||||
POINTS_DB_FILE: str = "data/danding_points/points.db"
|
||||
POINTS_MAX_BALANCE: int = 0 # 0 = unlimited
|
||||
POINTS_MAX_PER_OPERATION: int = 0 # 0 = unlimited
|
||||
POINTS_LOG_RETENTION_DAYS: int = 365
|
||||
|
||||
class Config:
|
||||
env_prefix = "DANDING_"
|
||||
case_sensitive = True
|
||||
|
||||
@validator("POINTS_MAX_BALANCE", "POINTS_MAX_PER_OPERATION", "POINTS_LOG_RETENTION_DAYS")
|
||||
def validate_non_negative(cls, v):
|
||||
if v < 0:
|
||||
raise ValueError("Value must be non-negative")
|
||||
return v
|
||||
|
||||
@validator("POINTS_DB_FILE")
|
||||
def validate_db_path(cls, v):
|
||||
if not v:
|
||||
raise ValueError("Database file path cannot be empty")
|
||||
return v
|
||||
Reference in New Issue
Block a user