tjysunset / dumbqq Goto Github PK
View Code? Open in Web Editor NEW对SmartQQ API的C#封装。(由于作者懒出了一定境界现已停止维护)
License: MIT License
对SmartQQ API的C#封装。(由于作者懒出了一定境界现已停止维护)
License: MIT License
实现方法参考https://github.com/pandolia/qqbot/blob/master/qqbot/plugins/passwordlogin.py
因为需要浏览器类巨大依赖,于解决方案内新开项目。
问题描述:Cookie登录功能不可用。
问题原因:这个方法没有加载ptwebqq,
vfwebqq
, uin
, psessionid
和hash
五个参数。
通过缓存文件登录失败(返回100012错误)后,如果不清除掉缓存,直接正常步骤(通过扫二维码)登陆,会在GetUinAndPsessionid()
步骤失败,也返回100012错误,
退出程序删除缓存文件(默认是“dump.json”)再运行,又可以正常登陆
地址:
https://github.com/WangCharlie/SmartQQ
SmartQQClient
// 登录
.Login((bytes) =>
{
using (var ms = new MemoryStream(bytes))
{
SmartQQClient.ConsoleWriteImage(new Bitmap(Image.FromStream(ms)));
Logger.Instance.Info("二维码已打印在屏幕,请使用手机QQ扫描。");
}
})
// 好友消息回调
.ReceivedFriendMessage((message) => {
message.Reply("test");
Logger.Instance.Info($"{message.Sender.Alias ?? message.Sender.Nickname}:{message.Content}");
})
// 群消息回调
.ReceivedGroupMessage((message) => {
Logger.Instance.Info(
$"[{message.Group.Name}]{message.Sender.Alias ?? message.Sender.Nickname}:{message.Content}");
if (message.Content.IsMatch(@"^\s*Knock knock\s*$"))
message.Reply("Who's there?");
else if (message.StrictlyMentionedMe)
message.Reply("什么事?");
})
// 讨论组消息回调
.ReceivedDiscussionMessage((message) =>
{
Logger.Instance.Info($"[{message.Discussion.Name}]{message.Sender.Nickname}:{message.Content}");
})
// 消息回显
.ReceivedMessageEchoEventArgs((e) => {
Logger.Instance.Info($"{e.Target.Name}>{e.Content}");
})
//开始服务
.Start((client) => {
Logger.Instance.Info($"欢迎,{client.Nickname}!");
});
Console.ReadLine();
解决方法:在查询群或讨论组成员/好友/加入的群或讨论组遇到NullPointerException时清空缓存并重试。
欢迎,绿砖!
2017-06-22 19:05:33,023 ERROR [13] DumbQQClient Enzio-PC\Enzio - System.NullRefe
renceException: 未将对象引用设置到对象的实例。
在 DumbQQConsoleDemo.Program.<>c.
79 -84行
Console.WriteLine(
$"[{message.Group.Name}]{message.Sender.Alias ?? message.Sender.Nickname}:{message.Content}");
if (message.Content.IsMatch(@"^\s*Knock knock\s*$"))
message.Reply("Who's there?");
else if (message.StrictlyMentionedMe)
message.Reply("什么事?");
public void Message(TargetType type, long id, string content)这个方法里面的这句话
var status = JObject.Parse(response.RawText)["errCode"].ToObject<int?>()
我开了控制台程序,并且登录成功了webqq,但隔了几个小时候,我再发送一条消息,执行Message方法,但上面这句代码报未将对象引用到对象实例。我调试看了下,response.RawText并没有errCode的字段了,只有retcode字段,且retcode字段的值是100012.
我不明白返回100012后该怎么做。也不明白返回100012的意思,求教!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.