simple-robot / simpler-robot

Simple Robot,一个bot风格的Kotlin多平台事件调度框架,异步高效、Java友好!/ A Bot-style Kotlin Multiplatform event scheduling framework, asynchronous and high-performance, java-friendly! 🐱😼😻😸
https://simbot.forte.love
GNU Lesser General Public License v3.0
512 stars 44 forks source link

[QU.] FriendAddRequest You had already responded it on another device. #141

Closed YunHerry closed 3 years ago

YunHerry commented 3 years ago

疑问描述

具体代码:

    @Listen(FriendAddRequest.class)
    public void test(FriendAddRequest friendAddRequest, MsgSender sender, MsgGet msgGet) {
        System.out.println(friendAddRequest);
        boolean agree = false;
        if ("XianYu".equals(msgGet.getText())) agree = true;
        sender.SETTER.setFriendAddRequest(friendAddRequest.getFlag(), null, agree, false);
    }

在监听FriendAddRequest,当第一次不符合要求拒绝后,第二次响应及之后的所有请求则会出现该问题:


MiraiEvent(id=1625793197000000, event=NewFriendRequestEvent(bot=Bot(3545028233), eventId=1625793197000000, message=我是daf, fromId=3209851541, fromGroupId=0, fromNick=wd))
MiraiEvent(id=1625793209000000, event=NewFriendRequestEvent(bot=Bot(3545028233), eventId=1625793209000000, message=XianYu, fromId=3209851541, fromGroupId=0, fromNick=wd))
Exception in thread "DefaultDispatcher-worker-3" java.lang.IllegalStateException: the request NewFriendRequestEvent(bot=Bot(3545028233), eventId=1625793209000000, message=XianYu, fromId=3209851541, fromGroupId=0, fromNick=wd) is outdated: You had already responded it on another device.
    at net.mamoe.mirai.internal.MiraiImpl.acceptNewFriendRequest$suspendImpl(MiraiImpl.kt:136)
    at net.mamoe.mirai.internal.MiraiImpl.acceptNewFriendRequest(MiraiImpl.kt)
    at net.mamoe.mirai.event.events.NewFriendRequestEvent.accept(friend.kt:90)
    at love.forte.simbot.component.mirai.sender.MiraiSetter$setFriendAddRequest$1.invokeSuspend(MiraiSetter.kt:76)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
ForteScarlet commented 3 years ago

请提供版本号

YunHerry commented 3 years ago

v2.0.3

ForteScarlet commented 3 years ago

使用目前最后的 releases 进行尝试

YunHerry commented 3 years ago

已解决该问题。