MiraiForum

    • Register
    • Login
    • Search
    • Popular
    • Recent
    • Unsolved
    • Tags
    • Groups
    • 友情链接

    一个愚蠢的问题:到底应该如何调试和启动插件?

    开发交流
    10
    45
    5283
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Orisland
      Orisland 摸鱼 last edited by

      java选手,完全不会kotlin。
      使用idea的插件进行创建,然后……就没有然后了。模板里只有plugin的初始化定义=。=
      那么问题来了,我该如何调试和测试插件呢?我甚至找不到bot的启动入口,我手动添加了core依赖启动后发现该依赖并不会读取我的plugin,我也不知道如何添加,我甚至也找不到plugin文件夹。
      求教难道真的需要每次调试必须反复打jar放入mirai的plugin文件夹进行测试吗?还是有其他方法我不知道?求帮忙啊。:expressionless:
      (主要想写不依赖其他插件的独立小插件,但是无从下手)

      1 Reply Last reply Reply Quote 0
      • RainChan
        RainChan 摸鱼 last edited by

        模板里的测试有启动代码,如果没有尝试一下另一个模板

        Orisland 1 Reply Last reply Reply Quote 0
        • Orisland
          Orisland 摸鱼 @RainChan last edited by

          @rainchan 你指的是?QQ20210529-210131@2x.png

          1 Reply Last reply Reply Quote 0
          • T
            Teeth last edited by

            This post is deleted!
            Orisland 1 Reply Last reply Reply Quote 0
            • Orisland
              Orisland 摸鱼 @Teeth last edited by

              @teeth 啊果然是需要两部操作吗。。不可以实时调试吗,两部的话我不知道要打包放多少次:cry:

              T 1 Reply Last reply Reply Quote 0
              • T
                Teeth @Orisland last edited by

                This post is deleted!
                Orisland 1 Reply Last reply Reply Quote 0
                • Orisland
                  Orisland 摸鱼 @Teeth last edited by

                  @rainchan 请问你的bot启动方式是?mcl还是core启动?我的这个plugin模板项目里没有任何的启动入口,现在的启动还是我硬加的......QQ20210529-211157@2x.png

                  T 1 Reply Last reply Reply Quote 0
                  • Juicesyo
                    Juicesyo 摸鱼 last edited by

                    一般是在
                    /src/test/kotlin/RunConsole.kt
                    不会kotlin也没关系,账号密码对号入座就行了。

                    Orisland 2 Replies Last reply Reply Quote 0
                    • Orisland
                      Orisland 摸鱼 @Juicesyo last edited by

                      @juicesyo 问题就在于,我没有这个文件,我照着例子翻了半天没找见,那个test还是我自己新建的...QQ20210529-211319@2x.png QQ20210529-211524@2x.png

                      1 Reply Last reply Reply Quote 0
                      • T
                        Teeth @Orisland last edited by

                        This post is deleted!
                        Orisland 1 Reply Last reply Reply Quote 0
                        • Juicesyo
                          Juicesyo 摸鱼 last edited by Juicesyo

                          him188/mirai-console-example-plugin (Kotlin DSL) mirai-console 示例插件 (Kotlin DSL)
                          Karlatemp/mirai-console-example-plugin (Groovy DSL) mirai-console 示例插件 (Groovy DSL)
                          project-mirai/MAPluginTemplate mirai-console 插件模板,同时支持MiraiAndroid和Jvm

                          Orisland 1 Reply Last reply Reply Quote 0
                          • Orisland
                            Orisland 摸鱼 @Teeth last edited by

                            @teeth 可是……问题就在于,我并不知道如何让console加载我的plugin。例子给出的test文件夹我这里其实是不存在的,我实在不知道如何让console加载我的plugin,才选择了core试试。

                            T Karlatemp 2 Replies Last reply Reply Quote 0
                            • Orisland
                              Orisland 摸鱼 @Juicesyo last edited by

                              @juicesyo 这几个我全翻过了,事实上官方给的例子我下午翻了大部分=。=。
                              所以我需要把例子中的test文件夹中的RunConsole.kt复制到我自己的项目中吗:dizzy_face:

                              1 Reply Last reply Reply Quote 0
                              • T
                                Teeth @Orisland last edited by

                                This post is deleted!
                                Orisland 1 Reply Last reply Reply Quote 0
                                • Orisland
                                  Orisland 摸鱼 @Teeth last edited by

                                  @teeth 问题就出在这。。模板里的test和runconsole我没有,我必须要手动复制包到mirai里。。。

                                  Orisland 1 Reply Last reply Reply Quote 0
                                  • Orisland
                                    Orisland 摸鱼 @Orisland last edited by

                                    @orisland 正常情况下不应该是可以快速在Plugin项目里进行实时调试吗,我看例子里也确实可以做得到,但是他们的那个文件我没有就是了。。我尝试手动自己建把=。=

                                    1 Reply Last reply Reply Quote 0
                                    • Orisland
                                      Orisland 摸鱼 @Juicesyo last edited by

                                      @juicesyo 没有任何例子的启动是java写的:dizzy_face: java插件的启动方式似乎和kotlin并不通用:dizzy_face:

                                      D yoonching 2 Replies Last reply Reply Quote 0
                                      • D
                                        diyigemt @Orisland last edited by

                                        @orisland
                                        你可以看看这个->qq-bot
                                        入口在这里->Plugin
                                        mirai-console的插件式机器人

                                        Orisland 1 Reply Last reply Reply Quote 0
                                        • Orisland
                                          Orisland 摸鱼 @diyigemt last edited by

                                          @diyigemt 我麻了,佬,请问你插件的调试运行方式是?这里特指测试插件的方式?是项目内调试,core核心自动启动调用插件,还是打包jar丢掉mirai里调试呢?我看项目内调试自己的插件是可以的,但是我不知道如何启用和加载。
                                          比如这个文件:官方给的kotlin例子

                                          D 1 Reply Last reply Reply Quote 0
                                          • D
                                            diyigemt @Orisland last edited by

                                            @orisland
                                            我是用Junit来测试的
                                            至于消息事件我给了个空MessageEvent
                                            实在需要内容的调试的时候自己先写死在代码里23333

                                            Orisland 1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 3
                                            • 1 / 3
                                            • First post
                                              Last post
                                            Powered by Mamoe Technologies & NodeBB | 友情链接 | 服务监控 | Contact