2018-07-21 00:46:34 +08:00
|
|
|
|
"""
|
|
|
|
|
Default configurations.
|
|
|
|
|
|
|
|
|
|
Any derived configurations must import everything from this module
|
|
|
|
|
at the very beginning of their code, and then set their own value
|
|
|
|
|
to override the default one.
|
|
|
|
|
|
|
|
|
|
For example:
|
|
|
|
|
|
2018-12-27 20:23:45 +08:00
|
|
|
|
>>> from nonebot.default_config import *
|
2018-07-21 00:46:34 +08:00
|
|
|
|
>>> PORT = 9090
|
|
|
|
|
>>> DEBUG = False
|
|
|
|
|
>>> SUPERUSERS.add(123456)
|
|
|
|
|
>>> NICKNAME = '小明'
|
|
|
|
|
"""
|
|
|
|
|
|
2018-06-25 16:50:34 +08:00
|
|
|
|
from datetime import timedelta
|
2018-10-15 11:06:31 +08:00
|
|
|
|
from typing import Container, Union, Iterable, Pattern, Optional, Dict, Any
|
2018-06-25 16:50:34 +08:00
|
|
|
|
|
2018-12-22 12:44:10 +08:00
|
|
|
|
from .typing import Expression_T
|
2018-10-14 20:32:00 +08:00
|
|
|
|
|
|
|
|
|
API_ROOT: str = ''
|
|
|
|
|
ACCESS_TOKEN: str = ''
|
2018-10-15 11:06:31 +08:00
|
|
|
|
SECRET: str = ''
|
2018-10-14 20:32:00 +08:00
|
|
|
|
HOST: str = '127.0.0.1'
|
|
|
|
|
PORT: int = 8080
|
|
|
|
|
DEBUG: bool = True
|
|
|
|
|
|
|
|
|
|
SUPERUSERS: Container[int] = set()
|
|
|
|
|
NICKNAME: Union[str, Iterable[str]] = ''
|
2019-02-21 22:23:43 +08:00
|
|
|
|
|
2018-10-14 20:32:00 +08:00
|
|
|
|
COMMAND_START: Iterable[Union[str, Pattern]] = {'/', '!', '/', '!'}
|
|
|
|
|
COMMAND_SEP: Iterable[Union[str, Pattern]] = {'/', '.'}
|
2019-02-21 22:23:43 +08:00
|
|
|
|
|
2018-10-14 20:32:00 +08:00
|
|
|
|
SESSION_EXPIRE_TIMEOUT: Optional[timedelta] = timedelta(minutes=5)
|
|
|
|
|
SESSION_RUN_TIMEOUT: Optional[timedelta] = None
|
|
|
|
|
SESSION_RUNNING_EXPRESSION: Expression_T = '您有命令正在执行,请稍后再试'
|
2019-02-21 22:23:43 +08:00
|
|
|
|
|
2018-10-14 20:32:00 +08:00
|
|
|
|
SHORT_MESSAGE_MAX_LENGTH: int = 50
|
2019-02-21 22:23:43 +08:00
|
|
|
|
|
2019-01-25 12:59:06 +08:00
|
|
|
|
DEFAULT_VALIDATION_FAILURE_EXPRESSION: Expression_T = '您的输入不符合要求,请重新输入'
|
2019-02-22 17:49:52 +08:00
|
|
|
|
MAX_VALIDATION_FAILURES: int = 3
|
2019-02-21 22:23:43 +08:00
|
|
|
|
TOO_MANY_VALIDATION_FAILURES_EXPRESSION: Expression_T = \
|
|
|
|
|
'您输入错误太多次啦,如需重试,请重新触发本功能'
|
2018-08-26 10:05:42 +08:00
|
|
|
|
|
2019-02-22 17:49:52 +08:00
|
|
|
|
SESSION_CANCEL_EXPRESSION: Expression_T = '好的'
|
|
|
|
|
|
2018-10-15 11:06:31 +08:00
|
|
|
|
APSCHEDULER_CONFIG: Dict[str, Any] = {
|
2018-08-26 10:05:42 +08:00
|
|
|
|
'apscheduler.timezone': 'Asia/Shanghai'
|
|
|
|
|
}
|