Skip to content

Commit

Permalink
3.0.9,新增logger丰富卡片消息
Browse files Browse the repository at this point in the history
  • Loading branch information
lunzhiPenxil committed Nov 28, 2023
1 parent cc46386 commit 023f665
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 4 deletions.
4 changes: 2 additions & 2 deletions OlivaDiceLogger/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"namespace" : "OlivaDiceLogger",
"message_mode" : "old_string",
"info" : "本模块为OlivaDice的日志模块,提供了跑团日志记录器,它可以在跑团过程中对日志进行记录,并由结果生成跑团日志,与在线的跑团日志渲染器进行联动、或发送日志邮件。",
"version" : "3.0.8",
"svn" : 16,
"version" : "3.0.9",
"svn" : 17,
"compatible_svn" : 101,
"priority" : 20030,
"support" : [
Expand Down
4 changes: 2 additions & 2 deletions OlivaDiceLogger/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
'''


OlivaDiceLogger_ver = '3.0.8'
OlivaDiceLogger_svn = 16
OlivaDiceLogger_ver = '3.0.9'
OlivaDiceLogger_svn = 17
OlivaDiceLogger_ver_short = '%s(%s)' % (str(OlivaDiceLogger_ver), str(OlivaDiceLogger_svn))

dataPath = './plugin/data/OlivaDice/unity'
Expand Down
61 changes: 61 additions & 0 deletions OlivaDiceLogger/msgReply.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@

import hashlib
import time
from datetime import datetime, timezone, timedelta
import uuid
import json
import traceback

def unity_init(plugin_event, Proc):
pass
Expand Down Expand Up @@ -275,6 +278,64 @@ def unity_reply(plugin_event, Proc):
)
tmp_reply_str = OlivaDiceCore.msgCustomManager.formatReplySTR(dictStrCustom['strLoggerLogUrl'], dictTValue)
replyMsg(plugin_event, tmp_reply_str)
try:
if plugin_event.indeAPI.hasAPI('create_message'):
plugin_event.indeAPI.create_message(
chat_type = 'group',
chat_id = plugin_event.data.group_id,
content_type = 10,
content = json.dumps(
[
{
"type": "card",
"theme": "primary",
"color": "#009FE9",
"size": "lg",
"modules": [
{
"type": "header",
"text": {
"type": "plain-text",
"content": "您的日志将在如下时间后过期,请尽快点击按钮提取"
}
},
{
"type": "countdown",
"mode": "day",
"endTime": int((int(datetime.now(timezone.utc).timestamp()) + 7 * 24 * 60 * 60) * 1000)
},
{
"type": "action-group",
"elements": [
{
"type": "button",
"theme": "info",
"value": str(dictTValue['tLogUrl']),
"click": "link",
"text": {
"type": "plain-text",
"content": "点我提取日志"
}
}
]
},
{
"type": "context",
"elements": [
{
"type": "plain-text",
"content": "OlivaDice - 青果核心掷骰机器人"
}
]
}
]
}
],
ensure_ascii=False
)
)
except Exception as e:
traceback.print_exc()
else:
tmp_reply_str = OlivaDiceCore.msgCustomManager.formatReplySTR(dictStrCustom['strLoggerLogAlreadyEnd'], dictTValue)
replyMsg(plugin_event, tmp_reply_str)
Expand Down

0 comments on commit 023f665

Please sign in to comment.