请问,我修改后的日上限监测脚本只能在一段时间内监测到上限(尤其是跳海程序)并返回已上限的回复,但是,同样的群,同样群成员等待一段时间后再次发送跳海指令,又是正常回复且重新计算跳海次数了。是否是代码出了什么问题?还是某些默认设置改错了?
-- 跳海,默认为“跳进海里”
drown_self_order = "跳进海里"
--限制跳海名单
banned_drawn_qq = "xxxxxxxxx"
--限制跳海名单的跳海上限
banned_everyday_max_drawn = 1
-- 跳海程序(会往海里添加一具尸体)
function bottle_num(msg)
if ( msg.fromQQ == banned_drawn_qq ) then
local letter = read_file(bottle_text_path)
local letter_list = {}
local today_drawn = getUserToday(msg.fromQQ,"DB_everyday_drown")
letter_list = Split(letter,"c2xhc2g=")
if (today_drawn>= banned_everyday_max_drawn) then
return "一位英俊的菲林少年注意到了{nick}近日的反常举动,并将其报告给了这片海域的监视者。\n警觉的监视者加强了海岸的安全防护,{nick}现在只能遥望着海面沉浮的".. #letter_list-1 .."个物体独自兴叹了。"
else
date=os.date("%Y-%m-%d %H:%M:%S")
if ( msg.fromGroup == "0" ) then
text_full = "[CQ:image,url=http://q1.qlogo.cn/g?b=qq&nk="..msg.fromQQ.."&s=640]\n海面飘来了"..getUserConf(msg.fromQQ,"nick","某人").."的浮尸。\nTA于"..date.."悄悄潜入海底……TA在泰拉的渊洄中望见了什么?唯有回望TA的深渊知晓。c2xhc2g="
else
text_full = "[CQ:image,url=http://q1.qlogo.cn/g?b=qq&nk="..msg.fromQQ.."&s=640]\n海面飘来了"..getUserConf(msg.fromQQ,"nick","某人").."的浮尸。\n他于"..date.."在"..getGroupConf(msg.fromGroup, "name", "获取群名参数错误!").."("..msg.fromGroup..")处的海边沉入深海——回归一切的起源,回归诞生的黑暗。c2xhc2g="
end
write_file(bottle_text_path,text_full)
setUserToday(msg.fromQQ, "DB_everyday_drown", today_drawn+1)
return "{nick}仿佛被某种声音——某种音乐——引向海岸,等{nick}回过神,波涛与黑暗已经卷挟着".. #letter_list-1 .."个物体一并汹涌而来。\n……\n它们吞噬了{nick},也将永远伴随TA。"
end
end
local today_drawn = getUserToday(msg.fromQQ,"DB_everyday_drown")
if ( today_drawn >= DB_everyday_max_drown ) then
local letter = read_file(bottle_text_path)
local letter_list = {}
letter_list = Split(letter,"c2xhc2g=")
reply_list = {
"{nick}试图重温被海水与寒冷包围浸没的感觉;意识浮沉之际,".. #letter_list-1 .."道影子在视野中一晃而过。\n……\n眨眼间,{nick}在跃落的海岸醒来,一位英俊的菲林少年正疑惑又担忧地望着TA。{nick}不记得在海中看到的光景,唯有咸涩的海盐残留在皮肤上,仿佛音乐与求死的极乐都是一场幻梦。",
"{nick}刚想再次跳入海里,却被一位英俊的菲林少年拉住了手腕。\n“请不要如此轻贱生命。”他蹙着眉说。\n{nick}只能依稀看见".. #letter_list-1 .."个物体在波浪中沉浮:那海水依旧深邃,却不再拥有吸引{nick}投身其中的魔力。TA跟随着少年的脚步,踉踉跄跄离开了海岸。"
}
random_reply = reply_list[math.random(#reply_list)]
return random_reply
else
local letter = read_file(bottle_text_path)
local letter_list = {}
letter_list = Split(letter,"c2xhc2g=")
date=os.date("%Y-%m-%d %H:%M:%S")
if ( msg.fromGroup == "0" ) then
text_full = "[CQ:image,url=http://q1.qlogo.cn/g?b=qq&nk="..msg.fromQQ.."&s=640]\n海面飘来了"..getUserConf(msg.fromQQ,"nick","某人").."的浮尸。\nTA于"..date.."悄悄潜入海底……TA在泰拉的渊洄中望见了什么?唯有回望TA的深渊知晓。c2xhc2g="
else
text_full = "[CQ:image,url=http://q1.qlogo.cn/g?b=qq&nk="..msg.fromQQ.."&s=640]\n海面飘来了"..getUserConf(msg.fromQQ,"nick","某人").."的浮尸。\n他于"..date.."在"..getGroupConf(msg.fromGroup, "name", "获取群名参数错误!").."("..msg.fromGroup..")处的海边沉入深海——回归一切的起源,回归诞生的黑暗。c2xhc2g="
end
write_file(bottle_text_path,text_full)
setUserToday(msg.fromQQ, "DB_everyday_drown", today_drawn+1)
return "{nick}仿佛被某种声音——某种音乐——引向海岸,等{nick}回过神,波涛与黑暗已经卷挟着".. #letter_list-1 .."个物体一并汹涌而来。\n……\n它们吞噬了{nick},也将永远伴随TA。"
end
end
msg_order[drown_self_order] = "bottle_num"