Coder Social home page Coder Social logo

miraigo-template's Introduction

Hey 👋

HIT(Harbin Institue of Technology) Master graduates. Now work for NXP

Languages

  • C / C++
  • Rust
  • Go
  • Python
  • Kotlin
  • Verilog
  • Latex

Skills

  • Full Stack
  • Embedded (baremetal, embedded linux, FPGA)
  • Deep leraning

What Im doing now?

Contact me

miraigo-template's People

Contributors

akaany avatar asjdf avatar cutereimu avatar dependabot[bot] avatar hugozys avatar logiase avatar orzogc avatar sora233 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

miraigo-template's Issues

bitset依赖的问题?

PS Y:\q> go get github.com/Logiase/MiraiGo-Template
go: downloading github.com/Logiase/MiraiGo-Template v0.0.0-20210909051214-2b190772378a
go get: github.com/Logiase/MiraiGo-Template@none updating to
github.com/Logiase/[email protected] requires
github.com/willf/[email protected]: parsing go.mod:
module declares its path as: github.com/bits-and-blooms/bitset
but was required as: github.com/willf/bitset

无法登录

遇到使用Android Phone时显示
Android Phone Protocol DO NOT SUPPORT Slide verify
please use other protocol
使用MacOS时显示
当前版本过低,请升级到QQ最新版本。
使用IPad和AndroidWatch时输入验证码后显示
当前上网环境异常,请更换网络环境或在常用设备上登录或稍后再试

能否问下

希望能取消历史消息的接收

机器人启动并接收到一条消息后,miraiGO将会刷新出大量的历史消息,似乎最大消息数量为70条左右,而这可能会导致module中的命令在短时间内被频繁的触发。
比如在加载第三方Module:logiase.autoreply时,根据关键词,机器人可能会在短时间内大量的自动回复,造成疯狂刷屏的情况。

当前版本过低,请升级到QQ最新版本。

使用 device_test.go 生成 device.json后,登录提示这个。

time="2021-02-12T11:15:44+08:00" level=info msg="initializing modules ..." bot=internal
time="2021-02-12T11:15:44+08:00" level=info msg="all modules initialized" bot=internal
time="2021-02-12T11:15:44+08:00" level=info msg="registering modules serve functions ..." bot=internal
time="2021-02-12T11:15:44+08:00" level=info msg="all modules serve functions registered" bot=internal
time="2021-02-12T11:15:44+08:00" level=info msg="starting modules tasks ..." bot=internal
time="2021-02-12T11:15:44+08:00" level=info msg="tasks running" bot=internal
time="2021-02-12T11:15:44+08:00" level=fatal msg="login failed: 当前版本过低,请升级到QQ最新版本。" bot=internal

更换版本后编译报错

➜ make build
GOOS=linux GOARCH=amd64 \
go build -o bin/mirai-chess-bot-linux-amd64-v1.9.0 \
cmd/bot/bot.go
# github.com/Logiase/MiraiGo-Template/bot
../../../.golang/pkg/mod/github.com/!logiase/!mirai!go-![email protected]/bot/bot.go:58:16: undefined: client.SystemDeviceInfo
../../../.golang/pkg/mod/github.com/!logiase/!mirai!go-![email protected]/bot/bot.go:88:16: undefined: client.SystemDeviceInfo
../../../.golang/pkg/mod/github.com/!logiase/!mirai!go-![email protected]/bot/bot.go:99:44: undefined: client.SystemDeviceInfo
../../../.golang/pkg/mod/github.com/!logiase/!mirai!go-![email protected]/bot/protocol.go:18:9: undefined: client.SystemDeviceInfo
make: *** [Makefile:29: bin/mirai-chess-bot-linux-amd64-v1.9.0] Error 1
module github.com/aimerneige/MiraiChess

go 1.19

require (
    github.com/Logiase/MiraiGo-Template v0.0.0-20221120093149-c0c90b30689e
    github.com/Mrs4s/MiraiGo v0.0.0-20230220070519-af032dec9677


)

可以编译的版本:

module github.com/aimerneige/MiraiChess

go 1.19

require (
    github.com/Logiase/MiraiGo-Template v0.0.0-20220412065005-27063e73adf8
    github.com/Mrs4s/MiraiGo v0.0.0-20220828090150-a3c348100dfe

)

底层库不太了解,不知道哪里出了问题

登陆之后问题

INFO[0005] 扫码成功, 请在手机端确认登录. bot=internal
INFO[0008] start reload friends list bot=internal
INFO[0008] load 28 friends bot=internal
INFO[0008] start reload groups list bot=internal
INFO[0008] load 7 groups bot=internal

扫码登陆之后 加载到这里没反应了

内置的log根本就没触发

本地代码是复制的app.go里的, 没有任何更改, 扫码登录之后, 只显示了几条加载好友和群组的日志, 发消息测试没有任何反应

time="2022-05-19T19:07:21+08:00" level=info msg="扫码成功, 请在手机端确认登录." bot=internal
time="2022-05-19T19:07:26+08:00" level=info msg="start reload friends list" bot=internal
time="2022-05-19T19:07:27+08:00" level=info msg="load 2 friends" bot=internal
time="2022-05-19T19:07:27+08:00" level=info msg="start reload groups list" bot=internal
time="2022-05-19T19:07:29+08:00" level=info msg="load 3 groups" bot=internal

登录相关:二维码失效或存在异常

Q:

经个人测试,在个人电脑以及寝室路由器上可以成功扫描二维码进行登录
可部署到腾讯和阿里云服务器上二维码却扫描失败,请问这种情况该怎么处理

Screenshot_20220420-173218
有尝试过账号密码session token的那种形式,但是好像现在账号密码登录默认都跳转至二维码扫描了?

希望可以及时得到解答!

消息发送时间过长,发送失败

机器人在线时间长后,就会只能接收消息,无法发送长消息(只能回复2个字以下)。
发送消息返回的message.GroupMessage.id为-1,时长为5s,初步判断是qq服务器没有响应导致的超时。
只能重新登录,但重新登录时间久后也会出现同样的问题。
情况与mamoe/mirai#527 相同,不清楚miraigo中有没有修复这个问题。

使用任何协议均无法登陆:请你稍后重试。

依赖已更新,但是无法登陆QQ,这是为啥呢?

time="2021-01-05T11:10:33+08:00" level=error msg="unable to read './device.json'" error="open ./device.json: The system cannot find the file specified." util=ReadFile
time="2021-01-05T11:10:33+08:00" level=info msg="creating device.json" bot=internal
time="2021-01-05T11:10:33+08:00" level=info msg="initializing modules ..." bot=internal
time="2021-01-05T11:10:33+08:00" level=info msg="all modules initialized" bot=internal
time="2021-01-05T11:10:33+08:00" level=info msg="registering modules serve functions ..." bot=internal
time="2021-01-05T11:10:33+08:00" level=info msg="all modules serve functions registered" bot=internal
time="2021-01-05T11:10:33+08:00" level=info msg="starting modules tasks ..." bot=internal
time="2021-01-05T11:10:33+08:00" level=info msg="tasks running" bot=internal
time="2021-01-05T11:10:33+08:00" level=fatal msg="login failed: 请你稍后重试。(0xa)" bot=internal

device.json
{"display":"MIRAI.565230.001","product":"mirai","device":"mirai","board":"mirai","model":"mirai","finger_print":"mamoe/mirai/mirai:10/MIRAI.200122.001/9686330:user/release-keys","boot_id":"4a655b1c-6e44-2092-c660-9454d62bc09c","proc_version":"Linux version 3.0.31-508syQmz ([email protected])","protocol":0,"imei":"938566290598518"}

重构 Module 设计

考虑这样一个需求:在登陆成功后触发一次callback对所有好友/群组做一些操作,目前的callback Init/PostInit/Serve/Start并不能很好的支持这个操作。
WARN:这是一个break change。

请求增加图片发送教程或模板

发送文字信息可以通过message.NewSendingMessage().Append(message.NewText(“asdasd”))构造进行发送
但是尝试使用

dat, _ := ioutil.ReadFile("1.jpg")
message.NewSendingMessage().Append(message.NewImage(dat))

进行构造时发送失败,图片显示裂开。
返回的InternalId显示是个负数,感觉可能是发送方式错误或者是账号被风控。

bot无法登录

git clone仓库最新代码,启动bot时,报如下错误。尝试多个账号均报此错误
image

登录重试

在网络环境不好时候存在超时,也就不会重试对应的bot就掉线了

图片下载问题

messageData为空
调用http对url进行下载时,大概率下载为
image

已尝试如下

  reqest, _ := http.NewRequest("GET", field.Url, nil)
  reqest.Header.Add("Accept", "image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8")
  reqest.Header.Add("Accept-Encoding", "gzip, deflate, br")
  reqest.Header.Add("Cache-Control", "no-cache")
  reqest.Header.Add("Connection", "keep-alive")
  reqest.Header.Add("Host", "gchat.qpic.cn")
  reqest.Header.Add("Pragma", "no-cache")
  reqest.Header.Add("Sec-Fetch-Dest", "image")
  reqest.Header.Add("Sec-Fetch-Mode", "no-cors")
  reqest.Header.Add("Sec-Fetch-Site", "cross-site")
  reqest.Host = "gchat.qpic.cn"
  r, err := http.DefaultClient.Do(reqest)
  if err != nil {
	  return nil, err
  }
  defer r.Body.Close()
  robots, err := ioutil.ReadAll(r.Body)
  if err != nil {
	  return nil, err
  }

  t, err := request.QQClient.ImageOcr(field)
  if err != nil {
	  return nil, err
  }

上面的报错为服务忙,请稍后重试

直接调用wget url -O path可以完成下载,但次数过多被腾讯限制

对于发送ImageElement的一些问题

#2
按照这个issue,我试了一下,他提示我para error

imageData, _ := ioutil.ReadFile("./text.jpg")
dataBuffer := bytes.NewReader(imageData)
pImage, err := b.UploadPrivateImage(msg.Sender.Uin, dataBuffer)
if err != nil{
	fmt.Println("err: ",err)//para error
}
sendMessage := message.NewSendingMessage()
sendMessage.Append(pImage)
b.SendPrivateMessage(msg.Sender.Uin, sendMessage)

请问大佬,这个怎么解决啊

怎样判断发送群消息失败的响应结果

使用SendGroupMessage发送群消息,发送失败时,返回的GroupMessage.Id只有-1。

我遇到过有两个可能出现 -1
第1种是QQ风控,解决方法是修改消息体,重新发送就可以
第2种是限制发送群消息,这种没办法处理。

请问 哪里可以查看 -1 是 哪一种错误?

登录时提示 unknown login response: 239

备注:使用了 https://github.com/Logiase/MiraiGo-Template 为模板进行开发

问题

$ go run .
INFO[0000] initializing modules ...                      bot=internal
INFO[0000] all modules initialized                       bot=internal
INFO[0000] registering modules serve functions ...       bot=internal
INFO[0000] all modules serve functions registered        bot=internal
INFO[0000] starting modules tasks ...                    bot=internal
INFO[0000] tasks running                                 bot=internal
FATA[0004] unable to login                               bot=internal error="unknown login response: 239"
exit status 1

账号情况

  • 使用 MiraiOK 20200915.071520 linux-amd64 可成功登录
使用 MiraiOK 登录的日志记录
2020-11-20 16:22:01 I/MiraiOK: MiraiOK 20200915.071520 linux-amd64
2020-11-20 16:22:01 I/MiraiOK: 此程序以Affero GPL3.0协议发布,使用时请遵守协议
2020-11-20 16:22:01 I/MiraiOK: 部分开源于: github.com/LXY1226/MiraiOK
2020-11-20 16:22:01 I/MiraiOK: openjdk version "11.0.8" 2020-07-14
2020-11-20 16:22:01 I/MiraiOK: OpenJDK Runtime Environment (build 11.0.8+10-post-Ubuntu-0ubuntu118.04.1)
2020-11-20 16:22:01 I/MiraiOK: OpenJDK 64-Bit Server VM (build 11.0.8+10-post-Ubuntu-0ubuntu118.04.1, mixed mode, sharing)
2020-11-20 16:22:02 I/MiraiOK: 删除.lastupdate来在下次启动时强制检查更新
2020-11-20 16:22:02 I/MiraiOK: 启动Mirai...
2020-11-20 16:22:03 I/main: Starting mirai-console...
2020-11-20 16:22:04 I/main: Backend: version 1.0-M4, built on 2020-09-13 02:19:35.
2020-11-20 16:22:04 I/main: Frontend Pure: version 1.0-M4, provided by Mamoe Technologies
2020-11-20 16:22:04 V/main: Loading configurations...
2020-11-20 16:22:05 V/main: Loading JVM plugins...
2020-11-20 16:22:05 I/plugin: Successfully loaded plugin MiraiApiHttp
2020-11-20 16:22:05 V/main: 0 external PluginLoader(s) found. 
2020-11-20 16:22:05 V/main: 1 plugin(s) loaded.
2020-11-20 16:22:05 V/main: Loading PermissionService...
2020-11-20 16:22:05 V/main: Reloaded PermissionService settings.
2020-11-20 16:22:05 V/main: Loading built-in commands...
2020-11-20 16:22:06 V/main: Prepared built-in commands: help, login, permission, stop
2020-11-20 16:22:06 V/main: Enabling plugins...
2020-11-20 16:22:06 I/MiraiApiHttp: Starting Mirai HTTP Server in 0.0.0.0:8080
2020-11-20 16:22:06 I/MiraiApiHttp: Starting Mirai HTTP Server in 127.0.0.1:8080
2020-11-20 16:22:06 I/Mirai HTTP API: Http api server is running with authKey: *****authkey*redacted*****
2020-11-20 16:22:06 I/MiraiApiHttp: ????????: true
2020-11-20 16:22:06 I/MiraiApiHttp: ????????: true
2020-11-20 16:22:06 I/main: 1 plugin(s) enabled.
2020-11-20 16:22:06 I/main: Auto-login **qq*redacted**
2020-11-20 16:22:08 I/Bot **qq*redacted**: Logging in...
2020-11-20 16:22:10 I/Bot **qq*redacted**: Login successful
2020-11-20 16:22:10 I/main: mirai-console started successfully.

复现过程

git clone https://github.com/Logiase/MiraiGo-Template
cd MiraiGo-Template
nano application.yaml # 填入账号信息
nano device.json # 填入对应生成信息
go run .

其中,

device.json

{"display":"MIRAI.758943.001","product":"mirai","device":"mirai","board":"mirai","model":"mirai","finger_print":"mamoe/mirai/mirai:10/MIRAI.200122.001/3365128:user/release-keys","boot_id":"fb6d9e88-5083-d91f-e
709-193f87d57f81","proc_version":"Linux version 3.0.31-Zhl6gYUl ([email protected])","protocol":0,"imei":"438950160030129"}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.