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

[BUG]群里一发消息就报错 #8

Open
RushCN opened this issue Feb 12, 2024 · 13 comments
Open

[BUG]群里一发消息就报错 #8

RushCN opened this issue Feb 12, 2024 · 13 comments

Comments

@RushCN
Copy link

RushCN commented Feb 12, 2024

[20:34:32 WARN]: me.albert.amazingbot.shaded.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected STRING but was BEGIN_ARRAY at path $.message
[20:34:32 WARN]: at AmazingBot-4.0.10.jar//me.albert.amazingbot.shaded.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:225)
[20:34:32 WARN]: at AmazingBot-4.0.10.jar//me.albert.amazingbot.shaded.gson.Gson.fromJson(Gson.java:991)
[20:34:32 WARN]: at AmazingBot-4.0.10.jar//me.albert.amazingbot.shaded.gson.Gson.fromJson(Gson.java:1062)
[20:34:32 WARN]: at AmazingBot-4.0.10.jar//me.albert.amazingbot.shaded.gson.Gson.fromJson(Gson.java:1034)
[20:34:32 WARN]: at AmazingBot-4.0.10.jar//me.albert.amazingbot.bot.BotEventParser.parse(BotEventParser.java:48)
[20:34:32 WARN]: at AmazingBot-4.0.10.jar//me.albert.amazingbot.bot.BotEventParser.parseMessageEvent(BotEventParser.java:110)
[20:34:32 WARN]: at AmazingBot-4.0.10.jar//me.albert.amazingbot.bot.BotEventParser.parseEvent(BotEventParser.java:38)
[20:34:32 WARN]: at AmazingBot-4.0.10.jar//me.albert.amazingbot.bot.BotClient.processMessageRec(BotClient.java:131)
[20:34:32 WARN]: at AmazingBot-4.0.10.jar//me.albert.amazingbot.bot.BotClient.lambda$onMessage$0(BotClient.java:108)
[20:34:32 WARN]: at org.bukkit.craftbukkit.v1_20_R3.scheduler.CraftTask.run(CraftTask.java:93)
[20:34:32 WARN]: at org.bukkit.craftbukkit.v1_20_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57)
[20:34:32 WARN]: at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22)
[20:34:32 WARN]: at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
[20:34:32 WARN]: at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[20:34:32 WARN]: at java.base/java.lang.Thread.run(Thread.java:840)
[20:34:32 WARN]: Caused by: java.lang.IllegalStateException: Expected STRING but was BEGIN_ARRAY at path $.message
[20:34:32 WARN]: at AmazingBot-4.0.10.jar//me.albert.amazingbot.shaded.gson.internal.bind.JsonTreeReader.nextString(JsonTreeReader.java:181)
[20:34:32 WARN]: at AmazingBot-4.0.10.jar//me.albert.amazingbot.shaded.gson.internal.bind.TypeAdapters$15.read(TypeAdapters.java:393)
[20:34:32 WARN]: at AmazingBot-4.0.10.jar//me.albert.amazingbot.shaded.gson.internal.bind.TypeAdapters$15.read(TypeAdapters.java:381)
[20:34:32 WARN]: at AmazingBot-4.0.10.jar//me.albert.amazingbot.shaded.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:130)
[20:34:32 WARN]: at AmazingBot-4.0.10.jar//me.albert.amazingbot.shaded.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:221)
[20:34:32 WARN]: ... 14 more

在群里发什么信息都这样,压根没法转发过去

@letianpai-lpt
Copy link

letianpai-lpt commented Feb 12, 2024

同样的问题,服消息能同步到群,但是群消息无法被amazingbot正常解析,使用的QQ框架为Lagrange.Core

当在群内发送test时,收到的消息的DEBUG为
[22:45:34 INFO]: [AmazingBot] §a(DEBUG): 收到信息: {"message_type":"group","sub_type":"normal","message_id":4222544231,"group_id":123456789,"user_id":987654321,"anonymous":null,"message":[{"type":"text","data":{"text":"test"}}],"raw_message":"","font":0,"sender":{"user_id":987654321,"nickname":" ","card":"[PIXEL] newcovid","sex":"unknown","age":0,"area":"","level":"40","role":"admin","title":""},"time":1707749134,"self_id":2378776781,"post_type":"message"}

看起来只是需要修一下解析,但是我不懂java,希望作者大大尽快修复

@DoyoDia
Copy link

DoyoDia commented Feb 23, 2024

同样的问题,目测是amazingbot4只做了string消息格式的支持,没有做array的。而我用的机器人框架只支持array格式的消息上报。
关于消息格式的文档:https://docs.go-cqhttp.org/reference/#数组格式消息
感觉可以做一个中间件(ws代理),实现array到srting消息格式的转换

@DoyoDia
Copy link

DoyoDia commented Feb 24, 2024

我修复了这个问题,并且提了个PR #9
如果你们等不及,可以先在这里下载:我的仓库release
@letianpai-lpt
@RushCN

@RushCN
Copy link
Author

RushCN commented Feb 27, 2024

我修复了这个问题,并且提了个PR #9
如果你们等不及,可以先在这里下载:我的仓库release
@letianpai-lpt
@RushCN

感谢🙏

@zzj2039
Copy link

zzj2039 commented Jun 17, 2024

我修复了这个问题,并且提了个PR #9
如果你们等不及,可以先在这里下载:我的仓库release
@letianpai-lpt
@RushCN

你发的这个版本,在q群如果有人发表情或者图片什么的,后台就会报错...

@zzj2039
Copy link

zzj2039 commented Jun 18, 2024

@DoyoDia

@DoyoDia
Copy link

DoyoDia commented Jun 22, 2024

我修复了这个问题,并且提了个PR #9
如果你们等不及,可以先在这里下载:我的仓库release
@letianpai-lpt
@RushCN

你发的这个版本,在q群如果有人发表情或者图片什么的,后台就会报错...

我现在暂时没用这个插件,你能发一下你的日志吗,我看看是什么问题

@zzj2039
Copy link

zzj2039 commented Jun 22, 2024

我修复了这个问题,并且提了个PR #9
如果你们等不及,可以先在这里下载:我的仓库release
@letianpai-lpt
@RushCN

你发的这个版本,在q群如果有人发表情或者图片什么的,后台就会报错...

我现在暂时没用这个插件,你能发一下你的日志吗,我看看是什么问题

[13:56:53 WARN]: java.lang.NullPointerException: Cannot invoke "me.albert.amazingbot.shaded.gson.JsonElement.getAsString()" because the return value of "me.albert.amazingbot.shaded.gson.JsonObject.get(String)" is null [13:56:53 WARN]: at me.albert.amazingbot.bot.BotEventParser.parse(BotEventParser.java:57) [13:56:53 WARN]: at me.albert.amazingbot.bot.BotEventParser.parseEvent(BotEventParser.java:36) [13:56:53 WARN]: at me.albert.amazingbot.bot.BotClient.processMessageRec(BotClient.java:131) [13:56:53 WARN]: at me.albert.amazingbot.bot.BotClient.lambda$0(BotClient.java:108) [13:56:53 WARN]: at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:64) [13:56:53 WARN]: at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:52) [13:56:53 WARN]: at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) [13:56:53 WARN]: at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [13:56:53 WARN]: at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [13:56:53 WARN]: at java.base/java.lang.Thread.run(Thread.java:840)

@DoyoDia
Copy link

DoyoDia commented Jun 22, 2024

你说纯表情和纯图片消息吗,那我觉得不影响使用,可以忽略

@zzj2039
Copy link

zzj2039 commented Jun 22, 2024

你说纯表情和纯图片消息吗,那我觉得不影响使用,可以忽略

不是,文字带表情的情况下也会,而且服务器里看不到

@TsubakiDev
Copy link

可以使用我修复后的版本:
https://github.com/MGTown/AmazingBot-4/releases/tag/release

@zzj2039
Copy link

zzj2039 commented Jul 25, 2024

可以使用我修复后的版本: https://github.com/MGTown/AmazingBot-4/releases/tag/release

你尝试过在高版本使用这个插件吗?关服的时候提示zip什么的报错

@TsubakiDev
Copy link

可以使用我修复后的版本: https://github.com/MGTown/AmazingBot-4/releases/tag/release

你尝试过在高版本使用这个插件吗?关服的时候提示zip什么的报错

我运行的版本是 1.20.6, 关闭的时候一切正常

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

No branches or pull requests

5 participants