add miraiApiHTTP server settings
This commit is contained in:
@@ -27,6 +27,8 @@ rssbotLib=rssbot.dll
|
||||
- [databaseLocation](#databaselocation)
|
||||
- [retryTTL](#retryttl)
|
||||
- [botOwnerList](#botownerlist)
|
||||
- [miraiApiHTTPServer](#miraiapihttpserver)
|
||||
- [miraiApiHTTPAuthKey](#miraiapihttpauthkey)
|
||||
### token
|
||||
必填参数。Telegram Bot API Token。向[@BotFather](https://t.me/BotFather)请求新建Bot,即可得到。
|
||||
### maxCount
|
||||
@@ -57,6 +59,10 @@ rssbotLib=rssbot.dll
|
||||
可选参数。具有特殊权限的用户ID,这些用户可以使用部分特殊功能。可以使用`,`分隔两个不同的ID。
|
||||
特殊权限:
|
||||
- 可以强制更新RSS
|
||||
### miraiApiHTTPServer
|
||||
可选参数。指定[mirai-api-http](https://github.com/project-mirai/mirai-api-http)服务器位置。例如`http://localhost:8081`。可用来发送QQ消息。设置后必须设置[`miraiApiHTTPAuthKey`](#miraiapihttpauthkey)
|
||||
### miraiApiHTTPAuthKey
|
||||
可选参数。指定mirai-api-http的[AuthKey](https://github.com/project-mirai/mirai-api-http#开始使用)。
|
||||
## 命令行参数
|
||||
```text
|
||||
--rebuild-hashlist 重建hashList
|
||||
|
||||
10
readset.py
10
readset.py
@@ -54,6 +54,8 @@ class settings:
|
||||
d['retryTTL']) if 'retryTTL' in d and d['retryTTL'] != '' else RetryTTLList()
|
||||
self._botOwnerList = BotOwnerList(
|
||||
self._main, d['botOwnerList']) if 'botOwnerList' in d and d['botOwnerList'] != '' else BotOwnerList(self._main)
|
||||
self._miraiApiHTTPServer = d['miraiApiHTTPServer'] if 'miraiApiHTTPServer' in d and d['miraiApiHTTPServer'] != '' else None
|
||||
self._miraiApiHTTPAuthKey = d['miraiApiHTTPAuthKey'] if 'miraiApiHTTPAuthKey' in d and d['miraiApiHTTPAuthKey'] != '' else None
|
||||
|
||||
@property
|
||||
def token(self) -> str:
|
||||
@@ -103,6 +105,14 @@ class settings:
|
||||
def botOwnerList(self) -> BotOwnerList:
|
||||
return self._botOwnerList
|
||||
|
||||
@property
|
||||
def miraiApiHTTPServer(self) -> str:
|
||||
return self._miraiApiHTTPServer
|
||||
|
||||
@property
|
||||
def miraiApiHTTPAuthKey(self) -> str:
|
||||
return self._miraiApiHTTPAuthKey
|
||||
|
||||
|
||||
class commandline:
|
||||
def __init__(self, commandline: List[str] = None):
|
||||
|
||||
12
rssbot.py
12
rssbot.py
@@ -574,16 +574,20 @@ class main:
|
||||
self._commandLine = commandline()
|
||||
if len(sys.argv) > 1:
|
||||
self._commandLine.parse(sys.argv[1:])
|
||||
if not exists('settings.txt'):
|
||||
print('找不到settings.txt')
|
||||
return -1
|
||||
self._setting = settings(self, self._commandLine._config)
|
||||
if self._setting.token is None:
|
||||
print('没有机器人token')
|
||||
return -1
|
||||
self._telegramBotApiServer = self._setting.telegramBotApiServer
|
||||
self._db = database(self, self._setting.databaseLocation)
|
||||
if not exists('settings.txt'):
|
||||
print('找不到settings.txt')
|
||||
return -1
|
||||
self._mriaidb = MiraiDatabase(self, self._setting.databaseLocation)
|
||||
if self._setting.miraiApiHTTPServer is not None:
|
||||
if self._setting.miraiApiHTTPAuthKey is None:
|
||||
print('未设置AuthKey。')
|
||||
return -1
|
||||
self._mriaidb = MiraiDatabase(self, self._setting.databaseLocation)
|
||||
self._r = Session()
|
||||
if self._telegramBotApiServer != 'https://api.telegram.org':
|
||||
self._request("logOut", "post",
|
||||
|
||||
Reference in New Issue
Block a user