Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

加入IRC模块后一直刷新用户名单结束却自动退出登陆 #33

Open
moboard opened this issue Sep 15, 2016 · 2 comments
Open

Comments

@moboard
Copy link

moboard commented Sep 15, 2016

运行脚本之后,提示登陆成功,然后一直提示”info] C[微信用户:虚拟用户]已加入”,几分钟都不停,等把所有微信群加入频道之后就自动退出登陆了。
最新版的Mojo-weixin,使用以下两个脚本结果都是:

#!/usr/bin/env perl
use Mojo::Weixin;
my $client = Mojo::Weixin->new();
$client->load("ShowMsg");
$client->load("IRCShell",data=>{ listen=>[ {host=>"127.0.0.1",port=>6667},], 
load_friend => 1,
});
$client->load("ShowMsg");
#$client->load("Beauty"); 
$client->load("Beauty",data=>{
    file => './Beauty.dat', #可选,数据库保存路径,默认当前目录
     board=>[ 
              {command=>"看妹子", url=>'http://huaban.com/boards/19570858/'},
              {command=>"搞基"  , url=>'http://huaban.com/boards/28226262/'},
              {command=>"看帅哥", url=>'http://huaban.com/boards/27865046/'},
               ]
                                    });
#$client->load("Translation");
##$client->load("Weather");   #提示出错
#$client->load("XiaoiceReply");
#$client->load("XiaoiceReply",data=>{
#    is_need_at  => 1,           #可选,是否需要艾特我来触发智能回复
#    comamnd_on  => "小冰启动",  #可选,启动智能回复的命令,在手机端发送给任何人/群该消息内容即可
#    comamnd_off => "小冰停止",  #可选,停止智能回复的命令,在手机端发送给任何人/群该消息内容即可
#            });
$client->load("SmartReply");
#$client->load("KnowledgeBase");
$client->load("KnowledgeBase2",data=>{
    #allow_group => ["PERL学习交流"],  #可选,允许插件的群,可以是群名称或群号码
    #   ban_group   => ["私人群1","私人群2"], #可选,禁用该插件的群,可以是群名称或群号码
         file => './KnowledgeBase2.txt', #数据库保存路径,纯文本形式,可以编辑
         learn_command  => 'learn',     #可选,自定义学习指令关键字
         delete_command =>'del',      #可选,自定义删除指令关键字
         learn_operator => ["QQ1","QQ2"], #允许学习权限的操作人qq号
         delete_operator => ["QQ1"], #允许删除权限的操作人qq号
         mode => 'fuzzy', # fuzzy|regex|exact 分别表示模糊|正则|精确, 默认模糊
         check_time => 10, #默认10秒检查一次文件变更
         show_keyword => 1, #消息是否包含触发关键字信息,默认开启
                                        });
#$client->load("Riddle");
#$client->load("Riddle",data=>{
#     command     => "猜谜",   #可选,触发关键字
#     #apikey      => "xxxx",   #可选,参见 http://apistore.baidu.com/apiworks/servicedetail/440.html?qq-pf-to=pcqq.c2c
#     timeout     => 30, #等待答案的超时时间,超时后会自动公布答案
#             }); 
#$client->load("IRCShell");
$client->run();

第二个

#!/usr/bin/env perl
use Mojo::Weixin;
my $client = Mojo::Weixin->new();
$client->load("ShowMsg");
$client->load("IRCShell"); #加载IRCShell插件
$client->run();

另外有很多插件不能同时启动是什么原因呢?

@hexsum
Copy link
Owner

hexsum commented Sep 17, 2016

问题原因已经定位,正在想办法优化,原因主要是:
IRCShell插件加载过程中的一些好友相关的操作非常消耗性能,导致程序处理占用长的时间,影响了正常的接收消息(心跳)处理,导致服务端认为登录异常邀请重新登录

解决的思路:
1、把接收消息(心跳)处理延后到插件全部加载完成再执行
2、进一步优化插件加载过程中部分操作的执行效率

hexsum added a commit that referenced this issue Sep 17, 2016
   参见 #32
2)新增emoji_to_text参数,用于控制emoji表情的输出方式
3)调整接收消息的执行顺序为全部插件加载完毕后再执行,以避免加载插件耗时过长导致接收消息无法处理而被服务端邀请重新登录
   参见 #33
@hexsum
Copy link
Owner

hexsum commented Sep 17, 2016

已经针对第1点解决思路(把接收消息处理延后到插件全部加载完成再执行)进行了代码调整
可以使用最新github代码继续测试看看,关于如何使用github最新代码测试可以参考FAQ:

https://github.com/sjdy521/Mojo-Weixin/blob/master/FAQ.md#3-如何使用github上最新的代码进行测试

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants