MiraiForum

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

    core中如何启用mirai-login-solver-sakura

    技术交流板块
    3
    16
    873
    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.
    • H
      hu1240050829 last edited by

      未使用“ mirai-console”而是用的“ mirai-core”,如何启用“mirai-login-solver-sakura”呢?

      M 1 Reply Last reply Reply Quote 0
      • M
        misakarinkon @hu1240050829 last edited by misakarinkon

        @hu1240050829
        使用插件,作为jar包引入就行: https://github.com/cssxsh/fix-protocol-version#mirai-core-使用方法

        KFCFactory.json 和运行的jar文件一起就行,不需要 mirai-login-solver-sakura,详细的要看你具体使用什么服务

        1 Reply Last reply Reply Quote 0
        • MrXiaoM
          MrXiaoM 童心未泯 last edited by MrXiaoM

          将插件引入本地依赖,直接引用jar包就行,然后在登录之前

          // kotlin
          val server = SakuraTransmitDaemon(
              DaemonNettyNioEventLoopGroup(),
              NioServerSocketChannel::class.java,
              NioSocketChannel::class.java,
              SecureRandom().asKotlinRandom(),
              logger, // MiraiLogger
          )
          server.bootServer()
          bot.configuration.loginSolver = SakuraLoginSolver(server) // 窗口式解决器
          

          可能需要补一些依赖,比如miglayout-swing、gson、zxing、jline、netty,这个包没上仓库是比较麻烦点的

          H 1 Reply Last reply Reply Quote 0
          • H
            hu1240050829 @MrXiaoM last edited by

            @MrXiaoM DaemonNettyNioEventLoopGroup 这个类没有找到,不知道还需要引用哪个包

            MrXiaoM 1 Reply Last reply Reply Quote 0
            • MrXiaoM
              MrXiaoM 童心未泯 @hu1240050829 last edited by

              @hu1240050829

              implementation("io.netty:netty-codec-http:4.1.85.Final")
              implementation("io.netty:netty-codec-socks:4.1.85.Final")
              implementation("io.netty:netty-transport:4.1.85.Final")
              
              H 1 Reply Last reply Reply Quote 0
              • H
                hu1240050829 @MrXiaoM last edited by

                @MrXiaoM 这些全都有了,但是未找到“DaemonNettyNioEventLoopGroup”,这个应该时mirai相关项目包里面的吧?

                MrXiaoM 1 Reply Last reply Reply Quote 0
                • MrXiaoM
                  MrXiaoM 童心未泯 @hu1240050829 last edited by

                  @hu1240050829 哦,刚刚看了下,应该是 com.kasukusakura.mlss.DaemonNettyNioEventLoopGroup

                  H 1 Reply Last reply Reply Quote 0
                  • H
                    hu1240050829 @MrXiaoM last edited by

                    @MrXiaoM 所以这个类可以在哪儿找到呢

                    MrXiaoM 1 Reply Last reply Reply Quote 0
                    • MrXiaoM
                      MrXiaoM 童心未泯 @hu1240050829 last edited by

                      @hu1240050829 这个类就在插件里面啊

                      H 1 Reply Last reply Reply Quote 0
                      • H
                        hu1240050829 @MrXiaoM last edited by

                        @MrXiaoM 0.0.12版本,里面没有这个类

                        MrXiaoM 1 Reply Last reply Reply Quote 0
                        • MrXiaoM
                          MrXiaoM 童心未泯 @hu1240050829 last edited by

                          @hu1240050829 那知道了,是内部类,需要手动import并在文件开头写@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")

                          H 2 Replies Last reply Reply Quote 0
                          • H
                            hu1240050829 @MrXiaoM last edited by

                            @MrXiaoM java要如何操作呢?对kotlin不是很熟

                            MrXiaoM 1 Reply Last reply Reply Quote 0
                            • H
                              hu1240050829 @MrXiaoM last edited by

                              @MrXiaoM 好像知道怎么操作了,谢谢

                              1 Reply Last reply Reply Quote 0
                              • MrXiaoM
                                MrXiaoM 童心未泯 @hu1240050829 last edited by MrXiaoM

                                @hu1240050829 在Java可以直接访问Kotlin的内部类,kotlin的internal编译后中java访问就跟public一样。
                                只防自己人

                                H 1 Reply Last reply Reply Quote 0
                                • H
                                  hu1240050829 @MrXiaoM last edited by

                                  @MrXiaoM 尝试创建出server,但是请问如何创建JLineLoginSolver类呢?第二个 “lineReader”参数不是很清楚如何得到的,我看插件里面是通过“MiraiConsoleImplementationTerminalKt getLineReader”获取的,但是core里面怎么创建这个?

                                  MrXiaoM 1 Reply Last reply Reply Quote 0
                                  • MrXiaoM
                                    MrXiaoM 童心未泯 @hu1240050829 last edited by

                                    @hu1240050829 org.jline.reader.LineReader 的实例怎么创建就看你自己了,我并不知道 jline 如何使用

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