Skip to content

Commit

Permalink
用户记录优化
Browse files Browse the repository at this point in the history
  • Loading branch information
lunzhiPenxil committed Jan 6, 2022
1 parent 4226b7f commit 9d2a23e
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 5 deletions.
3 changes: 3 additions & 0 deletions OlivaDiceJoy/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"author" : "lunzhiPenxil",
"namespace" : "OlivaDiceJoy",
"message_mode" : "old_string",
"version" : "3.0.2",
"svn" : 10,
"compatible_svn" : 81,
"priority" : 30010,
"support" : [
{
Expand Down
4 changes: 3 additions & 1 deletion OlivaDiceJoy/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@
'''


OlivaDiceJoy_ver = '3.0.1'
OlivaDiceJoy_ver = '3.0.2'
OlivaDiceJoy_svn = 10
OlivaDiceJoy_ver_short = '%s(%s)' % (str(OlivaDiceJoy_ver), str(OlivaDiceJoy_svn))
2 changes: 1 addition & 1 deletion OlivaDiceJoy/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def init(plugin_event, Proc):
OlivaDiceJoy.msgReply.unity_init(plugin_event, Proc)

def init_after(plugin_event, Proc):
OlivaDiceCore.crossHook.dictHookList['model'].append(['OlivaDiceJoy', OlivaDiceJoy.data.OlivaDiceJoy_ver])
OlivaDiceCore.crossHook.dictHookList['model'].append(['OlivaDiceJoy', OlivaDiceJoy.data.OlivaDiceJoy_ver_short])
OlivaDiceJoy.msgReply.data_init(plugin_event, Proc)

def private_message(plugin_event, Proc):
Expand Down
11 changes: 11 additions & 0 deletions OlivaDiceJoy/msgCustom.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@
.mrrp 明日人品
此功能采用源自《梅花易数》的卜算方法,以日期与八字起卦进行推演,结果仅供参考。''',

'OlivaDiceJoy': '''[OlivaDiceJoy]
OlivaDice娱乐模块
本模块为青果跑团掷骰机器人(OlivaDice)娱乐模块,集成与跑团无关的历史遗留娱乐功能(如今日人品等)。
核心开发者: lunzhiPenxil仑质
[.help OlivaDiceJoy更新] 查看本模块更新日志
注: 本模块为可选不重要模块。''',

'OlivaDiceJoy更新': '''[OlivaDiceJoy]
3.0.2: 用户记录优化
3.0.0: 初始化项目''',

'zrrp': '&jrrp',
'mrrp': '&jrrp',
'今日人品': '&jrrp',
Expand Down
14 changes: 11 additions & 3 deletions OlivaDiceJoy/msgReply.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def unity_reply(plugin_event, Proc):
OlivaDiceCore.crossHook.dictHookList['prefix']
)
if flag_is_command:
tmp_hagID = None
if plugin_event.plugin_info['func_type'] == 'group_message':
if plugin_event.data.host_id != None:
flag_is_from_host = True
Expand All @@ -90,6 +91,13 @@ def unity_reply(plugin_event, Proc):
flag_is_from_group_have_admin = True
if plugin_event.data.sender['role'] in ['owner', 'admin']:
flag_is_from_group_admin = True
elif plugin_event.data.sender['role'] in ['sub_admin']:
flag_is_from_group_admin = True
flag_is_from_group_sub_admin = True
if flag_is_from_host and flag_is_from_group:
tmp_hagID = '%s|%s' % (str(plugin_event.data.host_id), str(plugin_event.data.group_id))
elif flag_is_from_group:
tmp_hagID = str(plugin_event.data.group_id)
flag_hostEnable = True
if flag_is_from_host:
flag_hostEnable = OlivaDiceCore.userConfig.getUserConfigByKey(
Expand All @@ -113,23 +121,23 @@ def unity_reply(plugin_event, Proc):
if flag_is_from_host:
if flag_hostEnable:
flag_groupEnable = OlivaDiceCore.userConfig.getUserConfigByKey(
userId = plugin_event.data.group_id,
userId = tmp_hagID,
userType = 'group',
platform = plugin_event.platform['platform'],
userConfigKey = 'groupEnable',
botHash = plugin_event.bot_info.hash
)
else:
flag_groupEnable = OlivaDiceCore.userConfig.getUserConfigByKey(
userId = plugin_event.data.group_id,
userId = tmp_hagID,
userType = 'group',
platform = plugin_event.platform['platform'],
userConfigKey = 'groupWithHostEnable',
botHash = plugin_event.bot_info.hash
)
else:
flag_groupEnable = OlivaDiceCore.userConfig.getUserConfigByKey(
userId = plugin_event.data.group_id,
userId = tmp_hagID,
userType = 'group',
platform = plugin_event.platform['platform'],
userConfigKey = 'groupEnable',
Expand Down

0 comments on commit 9d2a23e

Please sign in to comment.