Skip to content
This repository has been archived by the owner on Jun 5, 2018. It is now read-only.

已在你的项目基础上做了封装 #12

Open
telsav opened this issue Aug 24, 2017 · 0 comments
Open

已在你的项目基础上做了封装 #12

telsav opened this issue Aug 24, 2017 · 0 comments

Comments

@telsav
Copy link

telsav commented Aug 24, 2017

地址:
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();
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant