Closed LittleChest closed 1 year ago
配置文件:
run-command:
enabled: true
# 启用的 QQ群
qq-group:
- GroupID
# 指令前缀, 可以是多个字符, 比如 "~$"
command-prefix: '/'
# 指令最大长度 (不包括指令前缀)
command-max-length: 255
# 获取指令的正则表达式, 当第一个捕获组的内容与指令白名单中的匹配时则允许运行 (不带斜杠或前缀)
regex-command-main: '^([^ ]+)'
# 判断指令返回为空的正则, 匹配多行文本. (经过 pretreatment-command-message 处理后)
return-isNull: '^\s*$'
# 是否将主命令转换为小写再执行
always-lowercase: false
# 是否发送指令的输出, 关闭可提高性能或解决一些兼容性问题
return: true
# 等待指令运行多长时间再将结果发送到QQ群 (毫秒), 需要开启 run-command.return
# 如果你遇到了一些提前输出类似 "正在运行...请稍等" 消息的插件, 可以在 pretreatment-command-message 中配置完全删除这条消息. 然后 return-sleep-min 保持不变 :)
return-sleep-min: 10 # 最小等待时间
return-sleep-max: 5346 # 最大等待时间, 如果一些长耗时指令没有输出请增大此值
return-sleep-sampling-interval: 172 # 输出内容检查间隔, 如果经常执行长耗时指令可以增大此值
# 是否将指令的输出打印到控制台和日志
return-log: true
# 执行不在白名单中的指令时发送返回消息
message-miss: '未知命令'
# 运行无返回指令的消息
message-no-out: '命令未返回结果'
# 设置各组可执行的主命令白名单 (不带斜杠或前缀)
# 权限更高的用户将可以使用更低的用户的指令
# 如果添加一条 ___ALL_COMMAND___ 作为指令, 则表示此组可以使用所有指令, 此功能请勿随意使用 !
group:
# permission_<int> 是 MiraiMC 获取到的权限数字, 以后更新了其他权限只需要以此格式添加即可使用
permission_2: # 群主
- ___ALL_COMMAND___
permission_1: # 管理员
- ___ALL_COMMAND___
permission_0: # 成员
- list
- tps
报错信息:
[14:25:04 ERROR]: Could not pass event MiraiGroupMessageEvent to Chat2QQ v1.8.6
java.lang.NullPointerException: Cannot invoke "java.util.Map.get(Object)" because "io.github.aplini.chat2qq.Chat2QQ.group_cache_all" is null
at io.github.aplini.chat2qq.utils.Util.getNameFromCache(Util.java:46) ~[Chat2QQ.jar:?]
at io.github.aplini.chat2qq.utils.renderGroupMessage.getReplyVar(renderGroupMessage.java:40) ~[Chat2QQ.jar:?]
at io.github.aplini.chat2qq.utils.renderGroupMessage.renderMessage1(renderGroupMessage.java:147) ~[Chat2QQ.jar:?]
at io.github.aplini.chat2qq.listener.onGroupMessage.onGroupMessageReceive(onGroupMessage.java:26) ~[Chat2QQ.jar:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor13.execute(Unknown Source) ~[?:?]
at org.bukkit.plugin.EventExecutor$2.execute(EventExecutor.java:77) ~[leaves-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:77) ~[leaves-api-1.20.1-R0.1-SNAPSHOT.jar:git-Leaves-"e6d432f"]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[leaves-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:54) ~[leaves-1.20.1.jar:git-Leaves-"e6d432f"]
at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:126) ~[leaves-1.20.1.jar:git-Leaves-"e6d432f"]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:615) ~[leaves-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at me.dreamvoid.miraimc.bukkit.MiraiEvent.lambda$startListenEvent$8(MiraiEvent.java:121) ~[MiraiMC.jar:?]
at net.mamoe.mirai.event.EventChannel$subscribeAlways$2$1.invoke(EventChannel.kt:600) ~[MiraiMC.jar:?]
at net.mamoe.mirai.event.EventChannel$subscribeAlways$2$1.invoke(EventChannel.kt:600) ~[MiraiMC.jar:?]
at kotlinx.coroutines.InterruptibleKt.runInterruptibleInExpectedContext(Interruptible.kt:51) ~[MiraiMC.jar:?]
at kotlinx.coroutines.InterruptibleKt.access$runInterruptibleInExpectedContext(Interruptible.kt:1) ~[MiraiMC.jar:?]
at kotlinx.coroutines.InterruptibleKt$runInterruptible$2.invokeSuspend(Interruptible.kt:43) ~[MiraiMC.jar:?]
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) ~[MiraiMC.jar:?]
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) ~[MiraiMC.jar:?]
at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42) ~[MiraiMC.jar:?]
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95) ~[MiraiMC.jar:?]
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570) ~[MiraiMC.jar:?]
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) ~[MiraiMC.jar:?]
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677) ~[MiraiMC.jar:?]
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664) ~[MiraiMC.jar:?]
哦我没有开启群成员缓存 抱歉
即使将player-cache.enabled
设置为false
并重启服务器后也不能正确执行命令
即使将player-cache.enabled设置为false并重启服务器后也不能正确执行命令
玩家名称缓存不会影响执行指令的功能, 它只用来支持替换 QQID 为名称.
但实际上什么都没有发生 白名单仍然查无此人
你使用的是原版白名单? 我没适配原版命令, 同时据我所知原版命令的返回消息没法捕获.
可以使用一些插件比如 Ess 来解决.
关闭 run-command.return 应该可以解决原版命令的兼容性, 但是不会有返回消息
好 那么报错应该怎么解决呢
即使将player-cache.enabled设置为false并重启服务器后也不能正确执行命令
玩家名称缓存不会影响执行指令的功能, 它只用来支持替换 QQID 为名称.
但实际上什么都没有发生 白名单仍然查无此人
你使用的是原版白名单? ~我没适配原版命令~, 同时据我所知原版命令的返回消息没法捕获. 可以使用一些插件比如 Ess 来解决.
可以监听日志?我知道有个机器人就是通过读取logs下的日志实现的
关闭 run-command.return 应该可以解决原版命令的兼容性, 但是不会有返回消息
关闭return后的报错(已使用chat2qq reload
重载)
[17:17:00 ERROR]: Thread DefaultDispatcher-worker-2 failed main thread check: command dispatch
java.lang.Throwable: null
at org.spigotmc.AsyncCatcher.catchOp(AsyncCatcher.java:15) ~[leaves-1.20.1.jar:git-Leaves-"e6d432f"]
at org.bukkit.craftbukkit.v1_20_R1.CraftServer.dispatchCommand(CraftServer.java:984) ~[leaves-1.20.1.jar:git-Leaves-"e6d432f"]
at org.bukkit.Bukkit.dispatchCommand(Bukkit.java:1001) ~[leaves-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at io.github.aplini.chat2qq.listener.onGroupCommandMessage.onGroupMessageReceive(onGroupCommandMessage.java:147) ~[Chat2QQ.jar:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor14.execute(Unknown Source) ~[?:?]
at org.bukkit.plugin.EventExecutor$2.execute(EventExecutor.java:77) ~[leaves-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:77) ~[leaves-api-1.20.1-R0.1-SNAPSHOT.jar:git-Leaves-"e6d432f"]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[leaves-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:54) ~[leaves-1.20.1.jar:git-Leaves-"e6d432f"]
at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:126) ~[leaves-1.20.1.jar:git-Leaves-"e6d432f"]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:615) ~[leaves-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at me.dreamvoid.miraimc.bukkit.MiraiEvent.lambda$startListenEvent$8(MiraiEvent.java:121) ~[MiraiMC.jar:?]
at net.mamoe.mirai.event.EventChannel$subscribeAlways$2$1.invoke(EventChannel.kt:600) ~[MiraiMC.jar:?]
at net.mamoe.mirai.event.EventChannel$subscribeAlways$2$1.invoke(EventChannel.kt:600) ~[MiraiMC.jar:?]
at kotlinx.coroutines.InterruptibleKt.runInterruptibleInExpectedContext(Interruptible.kt:51) ~[MiraiMC.jar:?]
at kotlinx.coroutines.InterruptibleKt.access$runInterruptibleInExpectedContext(Interruptible.kt:1) ~[MiraiMC.jar:?]
at kotlinx.coroutines.InterruptibleKt$runInterruptible$2.invokeSuspend(Interruptible.kt:43) ~[MiraiMC.jar:?]
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) ~[MiraiMC.jar:?]
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) ~[MiraiMC.jar:?]
at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42) ~[MiraiMC.jar:?]
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95) ~[MiraiMC.jar:?]
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570) ~[MiraiMC.jar:?]
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) ~[MiraiMC.jar:?]
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677) ~[MiraiMC.jar:?]
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664) ~[MiraiMC.jar:?]
[17:17:00 ERROR]: Could not pass event MiraiGroupMessageEvent to Chat2QQ v1.8.6
java.lang.IllegalStateException: Asynchronous command dispatch!
at org.spigotmc.AsyncCatcher.catchOp(AsyncCatcher.java:16) ~[leaves-1.20.1.jar:git-Leaves-"e6d432f"]
at org.bukkit.craftbukkit.v1_20_R1.CraftServer.dispatchCommand(CraftServer.java:984) ~[leaves-1.20.1.jar:git-Leaves-"e6d432f"]
at org.bukkit.Bukkit.dispatchCommand(Bukkit.java:1001) ~[leaves-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at io.github.aplini.chat2qq.listener.onGroupCommandMessage.onGroupMessageReceive(onGroupCommandMessage.java:147) ~[Chat2QQ.jar:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor14.execute(Unknown Source) ~[?:?]
at org.bukkit.plugin.EventExecutor$2.execute(EventExecutor.java:77) ~[leaves-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:77) ~[leaves-api-1.20.1-R0.1-SNAPSHOT.jar:git-Leaves-"e6d432f"]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[leaves-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:54) ~[leaves-1.20.1.jar:git-Leaves-"e6d432f"]
at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:126) ~[leaves-1.20.1.jar:git-Leaves-"e6d432f"]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:615) ~[leaves-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at me.dreamvoid.miraimc.bukkit.MiraiEvent.lambda$startListenEvent$8(MiraiEvent.java:121) ~[MiraiMC.jar:?]
at net.mamoe.mirai.event.EventChannel$subscribeAlways$2$1.invoke(EventChannel.kt:600) ~[MiraiMC.jar:?]
at net.mamoe.mirai.event.EventChannel$subscribeAlways$2$1.invoke(EventChannel.kt:600) ~[MiraiMC.jar:?]
at kotlinx.coroutines.InterruptibleKt.runInterruptibleInExpectedContext(Interruptible.kt:51) ~[MiraiMC.jar:?]
at kotlinx.coroutines.InterruptibleKt.access$runInterruptibleInExpectedContext(Interruptible.kt:1) ~[MiraiMC.jar:?]
at kotlinx.coroutines.InterruptibleKt$runInterruptible$2.invokeSuspend(Interruptible.kt:43) ~[MiraiMC.jar:?]
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) ~[MiraiMC.jar:?]
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) ~[MiraiMC.jar:?]
at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42) ~[MiraiMC.jar:?]
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95) ~[MiraiMC.jar:?]
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570) ~[MiraiMC.jar:?]
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) ~[MiraiMC.jar:?]
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677) ~[MiraiMC.jar:?]
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664) ~[MiraiMC.jar:?]
即使将player-cache.enabled设置为false并重启服务器后也不能正确执行命令
玩家名称缓存不会影响执行指令的功能, 它只用来支持替换 QQID 为名称.
但实际上什么都没有发生 白名单仍然查无此人
你使用的是原版白名单? ~我没适配原版命令~, 同时据我所知原版命令的返回消息没法捕获. 可以使用一些插件比如 Ess 来解决.
可以监听日志?我知道有个机器人就是通过读取logs下的日志实现的
据我所知不行, 只能获取所有的日志, 没法指定获取哪些代码发出的日志. 一个可能的方案是监听发出指令后几毫秒的日志内容, 但是容易监听到其他重要的日志内容, 就没研究.
报错等我一段时间看看代码 (
好 那么报错应该怎么解决呢
java.lang.NullPointerException: Cannot invoke "java.util.Map.get(Object)" because "io.github.aplini.chat2qq.Chat2QQ.group_cache_all" is null
开启 MiraiMC 配置中的 bot.contact-cache.enable-group-member-list-cache
然后重启服务器. (用于支持 Chat2QQ 的 player-cache 功能)
Thread DefaultDispatcher-worker-2 failed main thread check: command dispatch java.lang.Throwable: null
试试最新的开发版本, 但是我没测试过: https://github.com/ApliNi/Chat2QQ/actions/runs/5559885100
好 那么报错应该怎么解决呢
java.lang.NullPointerException: Cannot invoke "java.util.Map.get(Object)" because "io.github.aplini.chat2qq.Chat2QQ.group_cache_all" is null
开启 MiraiMC 配置中的
bot.contact-cache.enable-group-member-list-cache
然后重启服务器. (用于支持 Chat2QQ 的 player-cache 功能)
已开启并重启服务器 但仍然报错 缓存已确认位于plugins/MiraiMC/MiraiBot/bots/[机器人QQ号]/cache/contacts/groups/[群号].json
好 那么报错应该怎么解决呢
java.lang.NullPointerException: Cannot invoke "java.util.Map.get(Object)" because "io.github.aplini.chat2qq.Chat2QQ.group_cache_all" is null
开启 MiraiMC 配置中的
bot.contact-cache.enable-group-member-list-cache
然后重启服务器. (用于支持 Chat2QQ 的 player-cache 功能)已开启并重启服务器 但仍然报错
我不知道错误内容,我猜你还需要开启 player-cache.enable。如果错误相同那应该是你使用了这个功能的变量(默认配置)
好 那么报错应该怎么解决呢
java.lang.NullPointerException: Cannot invoke "java.util.Map.get(Object)" because "io.github.aplini.chat2qq.Chat2QQ.group_cache_all" is null
开启 MiraiMC 配置中的
bot.contact-cache.enable-group-member-list-cache
然后重启服务器. (用于支持 Chat2QQ 的 player-cache 功能)
Thread DefaultDispatcher-worker-2 failed main thread check: command dispatch java.lang.Throwable: null
试试最新的开发版本, 但是我没测试过: https://github.com/ApliNi/Chat2QQ/actions/runs/5559885100
使用最新Action 在开启return的情况下执行/tps(由spark提供)并未向群内发送结果(也没有提示命令未命中或未返回结果)
等一下我机器人好像被风控了
java.lang.NullPointerException: Cannot invoke "java.util.Map.get(Object)" because "io.github.aplini.chat2qq.Chat2QQ.group_cache_all" is null
已在最新开发版本修复, 之前改代码误删除了这个
或者使用指令 chat2qq setgroupcacheall
临时解决
但实际上什么都没有发生 白名单仍然查无此人