侧边栏壁纸
博主头像
DeQ

江流宛转绕芳甸,月照花林皆似霰

  • 累计撰写 23 篇文章
  • 累计创建 12 个标签
  • 累计收到 5 条评论

目 录CONTENT

文章目录

QQ机器人 Mirai初窥

DeQ
DeQ
2021-05-31 / 0 评论 / 0 点赞 / 1,868 阅读 / 2,021 字

前言

看到一些淘宝京东优惠券qq群24小时在发消息,想着做个qq机器人监听群消息并转换成我的链接,然后我也去建个QQ群24小时发消息,这不美滋滋~

文档

github

https://github.com/mamoe/mirai

mirai-core Api文档

https://github.com/mamoe/mirai/blob/dev/docs/CoreAPI.md

论坛 Mirai Forum

https://mirai.mamoe.net/

快速查找文档

其他人整理的文档

https://eiriksgata.github.io/mirai/#/README

Mirai文档分四大部分

  1. 机器人 Bots
  2. 联系人 Contacts
  3. 事件 Events
  4. 消息 Messages

事件列表一览

https://github.com/mamoe/mirai/blob/dev/mirai-core-api/src/commonMain/kotlin/event/events/README.md#%E4%BA%8B%E4%BB%B6

demo

Mirai 的使用教学

https://github.com/project-mirai/mirai-demos

作为用户使用

方法一、控制台版本

使用MCL (Mirai Console)

https://github.com/iTXTech/mcl-installer/releases

使用方法:

下载/更新插件等
https://github.com/iTXTech/mirai-console-loader/blob/master/scripts/README.md
登录bot等
https://github.com/mamoe/mirai-console/blob/master/docs/BuiltInCommands.md#mirai-console---builtin-commands

方法二、图形界面版本

https://github.com/sonder-joker/mirai-compose/releases

刚刚装好的 Mirai Console 是没有任何功能的。功能将由插件提供。

插件可以去论坛找。

开发

开发Mirai的插件

需要使用 Mirai Console来运行自己写的插件;请阅读 mirai-console 的配置插件项目

demo项目

(来自社区)Java + Maven 开发 mirai-console 插件实例:
https://github.com/PlexPt/mirai-poem

Java/Kotlin 不使用构建工具开发 mirai-console 插件实例
https://github.com/Karlatemp/mirai-demo-plugin

Mirai 控制台安装

1. 先安装`Mirai 控制台`

https://github.com/mamoe/mirai/blob/dev/docs/README.md

2. IDEA下载`Mirai Console`插件

让Mirai集成到自己的项目

需要使用 mirai-core,请阅读 配置项目依赖

demo项目(官方)

https://github.com/project-mirai/mirai-demos/tree/master/mirai-demo-java

踩坑

必须滑块验证登录

官方文档解决方案
https://github.com/project-mirai/mirai-login-solver-selenium

必须!
在 mirai 运行时中添加 JVM 属性 mirai.slider.captcha.supported (添加参数 -Dmirai.slider.captcha.supported) 以确认手动完成滑动验证

ticket在线服务
https://txhelper.glitch.me/

Linux
echo "验证码链接" | sed -e "s/ssl.captcha.qq.com/txhelper.glitch.me/g" | xargs curl

Windows PowerShell
$url = "验证码链接"
$url = url -replace "ssl.captcha.qq.com","txhelper.glitch.me"
Invoke-WebRequest $url | Select-Object -Expand Content

保存为html文件,再打开,再查看NetWork

群消息发不出,私聊发得出

可能账号被风控了,换个号试试
https://mirai.mamoe.net/topic/182/qq群-发消息异常

后记

没空搞,不玩了(代码刚写完[监控]和[转发]功能,差转链功能)
=.= / =.=

0

评论区