Skip to content

Commit

Permalink
自动更新开关
Browse files Browse the repository at this point in the history
  • Loading branch information
lunzhiPenxil committed Aug 29, 2022
1 parent a5d48dd commit 1ffc4ac
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
6 changes: 6 additions & 0 deletions OlivaDiceMaster/msgCustom.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
import OlivaDiceCore
import OlivaDiceMaster

dictConsoleSwitchTemplate = {
'default' : {
'masterAutoUpdate': 1
}
}

dictStrCustomDict = {}

dictStrCustom = {
Expand Down
8 changes: 8 additions & 0 deletions OlivaDiceMaster/msgCustomManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,11 @@ def initMsgCustom(bot_info_dict):
OlivaDiceCore.msgCustom.dictStrConst.update(OlivaDiceMaster.msgCustom.dictStrConst)
OlivaDiceCore.msgCustom.dictGValue.update(OlivaDiceMaster.msgCustom.dictGValue)
OlivaDiceCore.msgCustom.dictTValue.update(OlivaDiceMaster.msgCustom.dictTValue)
for dictConsoleSwitchTemplate_this in OlivaDiceMaster.msgCustom.dictConsoleSwitchTemplate:
if dictConsoleSwitchTemplate_this in OlivaDiceCore.console.dictConsoleSwitchTemplate:
OlivaDiceCore.console.dictConsoleSwitchTemplate[dictConsoleSwitchTemplate_this].update(
OlivaDiceMaster.msgCustom.dictConsoleSwitchTemplate[dictConsoleSwitchTemplate_this]
)
OlivaDiceCore.console.initConsoleSwitchByBotDict(bot_info_dict)
OlivaDiceCore.console.readConsoleSwitch()
OlivaDiceCore.console.saveConsoleSwitch()
11 changes: 9 additions & 2 deletions OlivaDiceMaster/webAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,24 @@ def init_getCheckAPI(botDict:dict):
def getCheckAPI(botDict:dict):
while True:
try:
flagSkip = False
webRes = None
for botDict_this in botDict:
if OlivaDiceCore.console.getConsoleSwitchByHash(
'masterAutoUpdate',
botDict_this
) != 1:
flagSkip = True
break
webRes = None
webRes = OlivaDiceMaster.webTool.GETHttpJson2Dict('http://api.oliva.icu/checkout/?hash=%s' % str(botDict_this))
if webRes == None:
if not flagSkip and webRes == None:
if OlivaDiceMaster.data.globalProc != None:
OlivaDiceMaster.data.globalProc.log(3, '访问更新检测接口失败!', [
('OlivaDice', 'default'),
('autoupdate', 'default')
])
if webRes != None and 'code' in webRes and webRes['code'] == 0:
if not flagSkip and webRes != None and 'code' in webRes and webRes['code'] == 0:
if (
'data' in webRes
) and (
Expand Down

0 comments on commit 1ffc4ac

Please sign in to comment.