Skip to content

Commit

Permalink
QQ频道相关优化
Browse files Browse the repository at this point in the history
  • Loading branch information
lunzhiPenxil committed Dec 10, 2021
1 parent e3f4216 commit ca71716
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 3 deletions.
2 changes: 1 addition & 1 deletion OlivaDiceCore/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import os
import uuid

OlivaDiceCore_ver = '3.0.7'
OlivaDiceCore_ver = '3.0.8'

exce_path = os.getcwd()

Expand Down
7 changes: 6 additions & 1 deletion OlivaDiceCore/helpDocData.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
青果核心用户群:661366095''',

'更新': '''[OlivaDiceCore]
3.0.8: 对接官方频道
3.0.7: 属性增量
3.0.6: 心跳系统
3.0.5: 固化版本
Expand Down Expand Up @@ -156,6 +157,8 @@
.name (cn/jp/en/enzh)
后接cn/jp/en/enzh则限定生成中文/日文/英文/英文中译名''',

'random': '''OlivaDice默认随机数生成器一概采用由random.org提供的真随机数,基于量子源于大气噪声,如对随机数结果有异议请向random.org发起质疑''',


'rc': '&ra',
'ti': '&疯狂症状',
Expand All @@ -167,5 +170,7 @@
'理智检定': '&sc',
'命名': '&nn',
'人物卡': '&st',
'车卡coc': '&coc'
'车卡coc': '&coc',
'随机数': '&random',
'随机数算法': '&random'
}
4 changes: 4 additions & 0 deletions OlivaDiceCore/msgCustom.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@
'strBotOff' : '关闭成功',
'strBotAlreadyOff' : '已经处于关闭状态',
'strBotNotUnderHost' : '无所属主频道',
'strBotHostLocalOn' : '本主频道开启成功',
'strBotAlreadyHostLocalOn' : '本主频道已经处于开启状态',
'strBotHostLocalOff' : '本主频道关闭成功',
'strBotAlreadyHostLocalOff' : '本主频道已经处于关闭状态',
'strBotHostOn' : '本主频道进入默认开启模式',
'strBotAlreadyHostOn' : '本主频道已经处于默认开启模式',
'strBotHostOff' : '本主频道进入默认关闭模式',
Expand Down
73 changes: 72 additions & 1 deletion OlivaDiceCore/msgReply.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,15 @@ def unity_reply(plugin_event, Proc):
userConfigKey = 'hostEnable',
botHash = plugin_event.bot_info.hash
)
flag_hostLocalEnable = True
if flag_is_from_host:
flag_hostLocalEnable = OlivaDiceCore.userConfig.getUserConfigByKey(
userId = plugin_event.data.host_id,
userType = 'host',
platform = plugin_event.platform['platform'],
userConfigKey = 'hostLocalEnable',
botHash = plugin_event.bot_info.hash
)
flag_groupEnable = True
if flag_is_from_group:
if flag_is_from_host:
Expand Down Expand Up @@ -471,21 +480,83 @@ def unity_reply(plugin_event, Proc):
else:
tmp_reply_str = dictStrCustom['strBotAlreadyOff'].format(**dictTValue)
replyMsg(plugin_event, tmp_reply_str)
elif isMatchWordStart(tmp_reast_str, 'host'):
tmp_reast_str = getMatchWordStartRight(tmp_reast_str, 'host')
tmp_reast_str = skipSpaceStart(tmp_reast_str)
if isMatchWordStart(tmp_reast_str, 'on'):
if flag_is_from_group:
if (flag_is_from_group_have_admin and flag_is_from_group_admin or not flag_is_from_group_have_admin) or flag_is_from_master:
if flag_is_from_host:
if flag_hostLocalEnable != True:
OlivaDiceCore.userConfig.setUserConfigByKey(
userConfigKey = 'hostLocalEnable',
userConfigValue = True,
botHash = plugin_event.bot_info.hash,
userId = plugin_event.data.host_id,
userType = 'host',
platform = plugin_event.platform['platform']
)
OlivaDiceCore.userConfig.writeUserConfigByUserHash(
userHash = OlivaDiceCore.userConfig.getUserHash(
userId = plugin_event.data.host_id,
userType = 'host',
platform = plugin_event.platform['platform']
)
)
tmp_reply_str = dictStrCustom['strBotHostLocalOn'].format(**dictTValue)
replyMsg(plugin_event, tmp_reply_str)
else:
tmp_reply_str = dictStrCustom['strBotAlreadyHostLocalOn'].format(**dictTValue)
replyMsg(plugin_event, tmp_reply_str)
else:
tmp_reply_str = dictStrCustom['strBotNotUnderHost'].format(**dictTValue)
replyMsg(plugin_event, tmp_reply_str)
elif isMatchWordStart(tmp_reast_str, 'off'):
if flag_is_from_group:
if (flag_is_from_group_have_admin and flag_is_from_group_admin or not flag_is_from_group_have_admin) or flag_is_from_master:
if flag_is_from_host:
if flag_hostLocalEnable != False:
OlivaDiceCore.userConfig.setUserConfigByKey(
userConfigKey = 'hostLocalEnable',
userConfigValue = False,
botHash = plugin_event.bot_info.hash,
userId = plugin_event.data.host_id,
userType = 'host',
platform = plugin_event.platform['platform']
)
OlivaDiceCore.userConfig.writeUserConfigByUserHash(
userHash = OlivaDiceCore.userConfig.getUserHash(
userId = plugin_event.data.host_id,
userType = 'host',
platform = plugin_event.platform['platform']
)
)
tmp_reply_str = dictStrCustom['strBotHostLocalOff'].format(**dictTValue)
replyMsg(plugin_event, tmp_reply_str)
else:
tmp_reply_str = dictStrCustom['strBotAlreadyHostLocalOff'].format(**dictTValue)
replyMsg(plugin_event, tmp_reply_str)
else:
tmp_reply_str = dictStrCustom['strBotNotUnderHost'].format(**dictTValue)
replyMsg(plugin_event, tmp_reply_str)
elif isMatchWordStart(tmp_reast_str, 'exit'):
if flag_is_from_group:
if (flag_is_from_group_have_admin and flag_is_from_group_admin) or flag_is_from_master:
tmp_reply_str = dictStrCustom['strBotExit'].format(**dictTValue)
replyMsg(plugin_event, tmp_reply_str)
time.sleep(1)
plugin_event.set_group_leave(plugin_event.data.group_id)
elif isMatchWordStart(tmp_reast_str, 'summary'):
elif isMatchWordStart(tmp_reast_str, 'summary') and flag_is_from_master:
tmp_reply_str = ''
tmp_reply_str += OlivaDiceCore.data.bot_summary
replyMsg(plugin_event, tmp_reply_str)
else:
tmp_reply_str = OlivaDiceCore.data.bot_info + '\n' + dictStrCustom['strBot'].format(**dictTValue)
replyMsg(plugin_event, tmp_reply_str)
return
#此频道关闭时中断处理
if not flag_hostLocalEnable and not flag_force_reply:
return
#此群关闭时中断处理
if not flag_groupEnable and not flag_force_reply:
return
Expand Down
1 change: 1 addition & 0 deletions OlivaDiceCore/userConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
dictUserConfigNoteDefault = {
'groupEnable' : True,
'hostEnable' : True,
'hostLocalEnable' : True,
'groupWithHostEnable' : False
}

Expand Down

0 comments on commit ca71716

Please sign in to comment.