是否可以设置当某个QQ号离线直接重启整个MCL
-
如标题,广东移动家庭宽带真的是太棒了每天凌晨两点三十八分必断网几分钟,然后就~机器人就掉线拉~真的是太棒了呢~
请问各位是否有方法可以让某个机器人掉线然后重新登录这个机器人 或者是直接重启。本人有尝试过监听机器人掉线事件然后对接mcsmanager来重启,但是效果不是很好。(掉线的控制台日志)
2023-05-27 02:38:41 V/Bot.: Event: BotOfflineEvent.Dropped(bot=Bot(), cause=HeartbeatFailedException: ***.AliveHe
artbeat, recoverable=true, cause=PacketTimeoutException(message=***.AliveHeartbeat Scheduler: Timeout receiving action response, caus
e=null), reconnect=true)
2023-05-27 02:38:42 W/Bot.***: Connection lost, reconnecting... (HeartbeatFailedException: ***.AliveHeartbeat, recoverable=tru
e, cause=PacketTimeoutException(message=***.AliveHeartbeat Scheduler: Timeout receiving action response, cause=null))
2023-05-27 02:38:43 E/Bot.***: Exception on parsing packet.
java.lang.IllegalStateException: Exception in net.mamoe.mirai.internal.network.notice.group.GroupMessageProcessor@387af546 while processing
packet PbPushMsg.
at net.mamoe.mirai.internal.network.components.NoticeProcessorPipelineImpl.handleExceptionInProcess(NoticeProcessorPipeline.kt:105) at net.mamoe.mirai.internal.network.components.NoticeProcessorPipelineImpl.handleExceptionInProcess(NoticeProcessorPipeline.kt:80) at net.mamoe.mirai.internal.pipeline.AbstractProcessorPipeline.process$suspendImpl(ProcessorPipeline.kt:289) at net.mamoe.mirai.internal.pipeline.AbstractProcessorPipeline.process(ProcessorPipeline.kt) at net.mamoe.mirai.internal.pipeline.AbstractProcessorPipeline.process$suspendImpl(ProcessorPipeline.kt:275) at net.mamoe.mirai.internal.pipeline.AbstractProcessorPipeline.process(ProcessorPipeline.kt) at net.mamoe.mirai.internal.network.protocol.packet.chat.receive.OnlinePushPbPushGroupMsg.decode(OnlinePush.PbPushGroupMsg.kt:37) at net.mamoe.mirai.internal.network.components.PacketCodecImpl.processBody(PacketCodec.kt:492) at net.mamoe.mirai.internal.network.handler.CommonNetworkHandler$PacketDecodePipeline.processBody(CommonNetworkHandler.kt:157) at net.mamoe.mirai.internal.network.handler.CommonNetworkHandler$PacketDecodePipeline.access$processBody(CommonNetworkHandler.kt:102
)
at net.mamoe.mirai.internal.network.handler.CommonNetworkHandler$PacketDecodePipeline$1$3$1.invokeSuspend(CommonNetworkHandler.kt:12
at net.mamoe.mirai.internal.network.handler.CommonNetworkHandler$PacketDecodePipeline$1$3$1.invoke(CommonNetworkHandler.kt) at net.mamoe.mirai.internal.network.handler.CommonNetworkHandler$PacketDecodePipeline$1$3$1.invoke(CommonNetworkHandler.kt) at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:55) at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:112) at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:126) at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:56) at kotlinx.coroutines.BuildersKt.launch(Unknown Source) at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(Builders.common.kt:47) at kotlinx.coroutines.BuildersKt.launch$default(Unknown Source) at net.mamoe.mirai.internal.network.handler.CommonNetworkHandler$PacketDecodePipeline$1.invokeSuspend(CommonNetworkHandler.kt:126) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164) at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.IllegalStateException: Failed to download forward message `gKffPHglRRrjLpFL2gmuJkM7etqOSQ7XQZ369AAkwmolKMcb3qfhvE24Cy8m
j6Uo`
at net.mamoe.mirai.internal.MiraiImpl.downloadForwardMessage$suspendImpl(MiraiImpl.kt:709) at net.mamoe.mirai.internal.MiraiImpl.downloadForwardMessage(MiraiImpl.kt) at net.mamoe.mirai.internal.message.data.ForwardMessageInternal.refine(LongMessageInternal.kt:127) at net.mamoe.mirai.internal.message.DeepMessageRefiner.refineDeep(RefinableMessage.kt:191) at net.mamoe.mirai.internal.message.ReceiveMessageHandlerKt.toMessageChainOnline(ReceiveMessageHandler.kt:53) at net.mamoe.mirai.internal.message.ReceiveMessageHandlerKt.toMessageChainOnline$default(ReceiveMessageHandler.kt:46) at net.mamoe.mirai.internal.network.notice.group.GroupMessageProcessor.processImpl(GroupMessageProcessor.kt:177) at net.mamoe.mirai.internal.network.notice.group.GroupMessageProcessor.processImpl(GroupMessageProcessor.kt:42) at net.mamoeocessorPipeline.kt:287) ... 27 more
Caused by: java.lang.IllegalStateException: NetworkHandler is already closed.
at net.mamoe.mirai.internal.network.handler.CommonNetworkHandler$StateClosed.sendPacketImpl(CommonNetworkHandler.kt:389) at net.mamoe.mirai.internal.network.handler.CommonNetworkHandler.sendPacketImpl(CommonNetworkHandler.kt:36) at net.mamoe.mirai.internal.network.handler.NetworkHandlerSupport.sendAndExpect(NetworkHandlerSupport.kt:123) at net.mamoe.mirai.internal.network.handler.NetworkHandlerSupport.sendAndExpect(NetworkHandlerSupport.kt:149) at net.mamoe.mirai.internal.network.handler.selector.SelectorNetworkHandler.sendAndExpect$suspendImpl(SelectorNetworkHandler.kt:103) at net.mamoe.mirai.internal.network.handler.selector.SelectorNetworkHandler.sendAndExpect(SelectorNetworkHandler.kt) at net.mamoe.mirai.internal.network.handler.NetworkHandler.sendAndExpect$default(NetworkHandler.kt:194) at net.mamoe.mirai.internal.MiraiImpl.downloadMultiMsgTransmit(MiraiImpl.kt:754) at net.mamoe.mirai.internal.MiraiImpl.downloadForwardMessage$suspendImpl(MiraiImpl.kt:707) ... 37 more
-
你可以自己写一个插件,机器人掉线后延时几分钟再执行关闭 mirai-console。
再配合 mcsmanager 关闭后自动重启或者在启动脚本里写关闭后重启就好 -
我记得 mcsmanager 有计划任务,设置个每天凌晨3点自动重启也不是不行