| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333 |
- #nop vim: set filetype=tt:;
- /*
- 本文件属于 PaoTin++ 的一部分。
- PaoTin++ © 2020~2023 的所有版权均由担子炮(dzp <danzipao@gmail.com>) 享有并保留一切法律权利
- 你可以在遵照 GPLv3 协议的基础之上使用、修改及重新分发本程序。
- */
- ///=== {
- ///// chat 模块用来分类聊天记录,分别存放到单独的日志文件里。
- // };
- #var lib_ui_chat[META] {
- {NAME} {聊天日志}
- {DESC} {抓取聊天信息,分置到不同的日志文件里去}
- {AUTHOR} {担子炮}
- };
- #var chat-channel {};
- #list chat-channel create {
- {{pattern}{求助} {action}{helpmeLog} {gag}{true}}
- {{pattern}{北侠QQ群} {action}{qqLog} {gag}{true}}
- {{pattern}{%!{闲聊|副本|谣言}} {action}{chatLog} {gag}{true}}
- {{pattern}{%!{门派|帮派|队伍}} {action}{chatLog} {gag}{true}}
- {{pattern}{%!{江湖|任务|交易}} {action}{jhLog} {gag}{true}}
- {{pattern}{%!{本地|区域|亡灵}} {action}{bdLog} {gag}{true}}
- {{pattern}{私聊} {action}{tellLog} {gag}{false}}
- };
- VAR {五绝名号} chat-wujue-title {};
- VAR {帮派名称} chat-group-name {};
- load-lib storage;
- load-lib alert;
- #func {lib_ui_chat.Init} {
- load-file {etc/ui-chat.tin};
- #var chat-wujue-title {@storage.GetGlobal{五绝名号}};
- #var chat-group-name {@storage.GetGlobal{帮派名称}};
- #return true;
- };
- #nop 普通聊天信息;
- #action {~^%c【%+2..5u%c】%c%*%+1..10u%c({[a-z A-Z]+})%c: %*$E} {
- chat.log {%2} {%0};
- } {4.994};
- #nop 单行的 emote 表情;
- #action {~{*UTF8}{?:^}%c【{\p{Han}{2,5}}】%*(%+1..S{| \S+}%s||%s{\S+ |}%+1..S)%s%c{|◆\p{Han}+◆}%c$E} {
- chat.log {%2} {%0};
- } {4.994};
- #nop 多行的 emote 表情;
- #action {~^%c【%+2..5u】%*$E} {
- chat.log-multi-line {%2} {%0};
- } {4.995};
- #alias {chat.log} {
- #local type {%1};
- #local text {%2};
- #if { "$type/$text" == "江湖/%*据闻如今的五绝是%*" } {
- #local wujue {@str.Plain{%2}};
- #replace wujue {%*【江湖】据闻如今的五绝是: %*} {&2};
- #replace wujue {、} {;};
- #var chat-wujue-title {};
- #local title {};
- #foreach {$wujue} {title} {
- #replace {title} {{*UTF8}{东.|西.|南.|北.|中..|}%*} {&1};
- #if { "$title" != "" } {
- #var chat-wujue-title {@sset.Add{{$chat-wujue-title};$title}};
- };
- };
- storage.SetGlobal 五绝名号 {$chat-wujue-title};
- };
- #if { @sset.Contains{{$chat-wujue-title};$type} } {
- #local type 闲聊;
- };
- #if { @sset.Contains{{$chat-group-name};$type} } {
- #local type 帮派;
- };
- #if { "$char-menpai-id[$type]" != "" } {
- #local type 门派;
- };
- #local id {};
- #loop {1} {&chat-channel[]} {id} {
- #local pattern {$chat-channel[$id][pattern]};
- #local action {$chat-channel[$id][action]};
- #local gag {$chat-channel[$id][gag]};
- #if { "$type" == "$pattern" } {
- $action $text;
- #if { "$gag" == "true" } {
- #line gag;
- };
- #return;
- };
- };
- };
- #alias {chat.log-multi-line} {
- #local type {%1};
- #local text {%2};
- chat.log {$type} {$text};
- #if { "$type" == "本地" } {
- #if { {$text} == {%*天空中突然闪出一道绚丽的火花%*} } {
- #class chat.log open;
- #action {~^%*{|ID=chat.log}$} {
- chat.log {%1} {%%0};
- } {4.993};
- #action {~^%c{\e\[2;37;0m|}\e[36m{|\e\[2;37;0m }{|\e\[0m}{|ID=chat.log}$} {
- chat.log {%1} {%%0};
- #class chat.log kill;
- } {4.992};
- #delay chat.log {#class chat.log kill} 0;
- #class chat.log close;
- };
- };
- #if { {$text} == {%*上次争胜后各门派完成主流任务统计:%*} } {
- #class chat.log open;
- #action {~^%*{|ID=chat.log}$} {
- chat.log {%1} {%%0};
- } {4.993};
- #action {~^%*次。%*$} {
- chat.log {%1} {%%0};
- #class chat.log kill;
- } {4.992};
- #delay chat.log {#class chat.log kill} 0;
- #class chat.log close;
- #return;
- };
- #if { "$type" == "江湖" } {
- #if { {$text} == {%*以下是江湖中{的|}%*排行榜%*} } {
- #class chat.log open;
- #action {~^%*{|ID=chat.log}$} {
- chat.log {%1} {%%0};
- } {4.993};
- #action {~^%c{[' -]+}%c{|ID=chat.log}$} {
- chat.log {%1} {%%0};
- #class chat.log kill;
- } {4.992};
- #delay chat.log {#class chat.log kill} 0;
- #class chat.log close;
- };
- #elseif { {$text} == {%*以下是最近一小时之内死于非命的江湖儿女。%*} } {
- #line multishot 4 #action {~^%*{|ID=chat.log}$} {
- chat.log {%1} {%%0};
- } {4.993};
- };
- #elseif { {$text} == {%*{[^m )]}\e[0m} } {
- #local lines {1};
- #if { {$text} == {%*请大家挖泥之余去各大BBS和论坛宣传北大侠客行,宣传内容详见%*} } {
- #local lines {2};
- };
- #line multishot $lines #action {~^%*{|ID=chat.log}$} {
- chat.log {%1} {%%0};
- } {4.993};
- };
- #return;
- };
- #if { "$type" != "{闲聊|求助|谣言}" } {
- #return;
- };
- #if { "$type" == "{闲聊|谣言}" && {$text} == {%* {\e\[0m}} } {
- #return;
- };
- #if { {$text} == {%c【求助】{我是大高手|大高手告诉|大高手说}%*} } {
- #return;
- };
- #if { {$text} == {%c【谣言】某人: 我看到了!!就是%*造的谣!!%c} } {
- #return;
- };
- #class chat.log open;
- #action {~^%*{|ID=chat.log}$} {
- chat.log {%1} {%%0};
- } {4.993};
- #action {~^%*(%w%s||%s{\S+ |}%+1..S)%c{|ID=chat.log}$} {
- chat.log {%1} {%%0};
- #class chat.log kill;
- } {4.992};
- #if { "$type" == "{闲聊|谣言}" } {
- #action {~^%*{\S \e\[0m}{|ID=chat.log}$} {
- chat.log {%1} {%%0};
- #class chat.log kill;
- } {4.992};
- };
- #delay chat.log {#class chat.log kill} 0;
- #class chat.log close;
- };
- #action {~^%c%u%c(%w)告诉你:%*$} {alert.Add 有私聊; chat.log 私聊 {%0}} {9.999};
- #action {~^%c%u%c回答你:%*$} {alert.Add 有私聊; chat.log 私聊 {%0}} {9.999};
- #action {~^%c你告诉%c%u%c:%*$} {chat.log 私聊 {%0}} {9.997};
- #action {~^%c你回答%c%u%c:%*$} {chat.log 私聊 {%0}} {9.997};
- #var chat-open-channels {UNKNOWN};
- #var chat-todo-channels {};
- ///=== {
- // ## chat.TuneOff <频道ID> [...]
- // 关闭聊天频道。参数为一个或多个频道 ID。
- // 可用的频道 ID 有:
- // - 常用: chat rumor qq rw jh helpme
- // - 不常用: bd fb tt group nation qy jy mp
- // };
- #alias {chat.TuneOff} {
- #info arguments save;
- #unvar info[ARGUMENTS][0];
- #local chans {@sset.Create{$info[ARGUMENTS][]}};
- #local chan {};
- #if { "$chat-open-channels" == "UNKNOWN" } {
- #foreach {$chans} {chan} {
- #var chat-todo-channels[$chan] {off};
- };
- };
- #else {
- #local todo {@sset.Intersection{{$chans};{$chat-open-channels}}};
- #foreach {$todo} {chan} {
- tune channel $chan;
- };
- };
- #return;
- };
- ///=== {
- // ## chat.TuneOn <频道ID> [...]
- // 打开聊天频道。参数为一个或多个频道 ID。
- // 可用的频道 ID 有:
- // - 常用: chat rumor qq rw jh helpme
- // - 不常用: bd fb tt group nation qy jy mp
- // };
- #alias {chat.TuneOn} {
- #info arguments save;
- #unvar info[ARGUMENTS][0];
- #local chans {@sset.Create{$info[ARGUMENTS][]}};
- #local chan {};
- #if { "$chat-open-channels" == "UNKNOWN" } {
- #foreach {$chans} {chan} {
- #var chat-todo-channels[$chan] {on};
- };
- };
- #else {
- #local todo {@sset.Diff{{$chans};{$chat-open-channels}}};
- #foreach {$todo} {chan} {
- tune channel $chan;
- };
- };
- #return;
- };
- ///=== {
- // ## chat.OpenAll
- // 打开所有聊天频道。
- // };
- #alias {chat.OpenAll} {
- tune channel;
- chat.TuneOn bd chat fb group helpme jh jy mp nation qq qy rumor rw tt;
- };
- ///=== {
- // ## chat.CloseAll
- // 关闭所有聊天频道。
- // };
- #alias {chat.CloseAll} {
- tune channel;
- chat.TuneOff bd chat fb group helpme jh jy mp nation qq qy rumor rw tt;
- };
- #nop 你现在打开的频道:bd, fb, group, helpme, jh, jy, mp, nation, qq, qy, rumor, rw, tt。;
- #action {^你现在打开的频道:%*。{|ID=paotin/chat}$} {
- #local channels {%1};
- #replace channels {, } {;};
- #var chat-open-channels {@sset.Create{$channels}};
- chat.tune;
- };
- #action {^你现在并没有打开任何频道。{|ID=paotin/chat}$} {
- #var chat-open-channels {};
- chat.tune;
- };
- #alias {chat.tune} {
- #local chan {};
- #foreach {*chat-todo-channels[]} {chan} {
- #local todo {$chat-todo-channels[$chan]};
- #local set {$chat-open-channels};
- #if { "$todo" == "on" && !@sset.Contains{{$set};$chan} } {
- tune channel $chan;
- };
- #elseif { "$todo" == "off" && @sset.Contains{{$set};$chan} } {
- tune channel $chan;
- };
- #unvar chat-todo-channels[$chan];
- };
- };
- event.HandleOnce {user-online} {chat/init} {ui/chat} {
- tune channel;
- set learn_emote 1;
- };
|