Giter VIP home page Giter VIP logo

Comments (7)

Him188 avatar Him188 commented on June 22, 2024

这个是 mirai-core 的问题,正在尝试解决

from mirai-demos.

CafeBabe202 avatar CafeBabe202 commented on June 22, 2024

好的,谢谢,请问使用以前的版本有这个问题吗?

from mirai-demos.

Him188 avatar Him188 commented on June 22, 2024

可能可以在1.0-EA2或者1.0-EA中正常

from mirai-demos.

CafeBabe202 avatar CafeBabe202 commented on June 22, 2024

我在另一个Issues中听说是匿名内部类的问题,好像有人已经调出来了,但是我却发生了新的异常
代码如下:

public static class CustomEventListener extends SimpleListenerHost {
        @EventHandler
        public ListeningStatus onFriendMsg(FriendMessageEvent event) {
            MessageReceipt<Contact> receipt = event.getSender().sendMessage("测试测试");
            receipt.recallIn(10000);
            return ListeningStatus.LISTENING;
        }

        @Override
        public void handleException(@NotNull CoroutineContext context, @javax.validation.constraints.NotNull Throwable exception) {
            super.handleException(context, exception);
        }
    }

    public static void main(String[] args) throws InterruptedException {
        final Bot bot = BotFactoryJvm.newBot(qq, password, new BotConfiguration() {
            {
                fileBasedDeviceInfo("deviceInfo.json");
            }
        });
        bot.login();
        Events.registerEvents(bot, new CustomEventListener());
        bot.join();
    }

异常信息:

Exception in thread "main" java.lang.IllegalArgumentException: Kotlin event handlers cannot have nullable parameter type.
	at net.mamoe.mirai.event.Events__JvmMethodListenersKt.registerEvent$Events__JvmMethodListenersKt(JvmMethodListeners.kt:298)
	at net.mamoe.mirai.event.Events__JvmMethodListenersKt.registerEvents(JvmMethodListeners.kt:233)
	at net.mamoe.mirai.event.Events.registerEvents(JvmMethodListeners.kt:1)
	at net.mamoe.mirai.event.Events__JvmMethodListenersKt.registerEvents$default(JvmMethodListeners.kt:230)
	at net.mamoe.mirai.event.Events.registerEvents$default(JvmMethodListeners.kt:1)
	at net.mamoe.mirai.event.Events.registerEvents(JvmMethodListeners.kt)
	at Test.main(Test.java:34)

6BPXI}Y(L8ZHT YU0UU@W91

from mirai-demos.

Him188 avatar Him188 commented on June 22, 2024

@HappyOnion801 请问这个问题发生时使用的 mirai 版本是多少?

from mirai-demos.

CafeBabe202 avatar CafeBabe202 commented on June 22, 2024

mirai-core-1.1.-EA2

from mirai-demos.

Him188 avatar Him188 commented on June 22, 2024

请在 mirai core 已有的issue中继续这类问题的讨论

from mirai-demos.

Related Issues (14)

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.