MiraiForum

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

    插件指令如何传入不同类型的参数?

    开发交流
    3
    4
    416
    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.
    • M
      MoeMegu last edited by

      想请教各位Mirai如何在指令中传入不同类型的参数进行处理。

      示例

      如果直接重载原方法,会导致两个方法传入的参数均无法被Mirai解析

      示例

      现在的思路是传入一个MessageContent,并分别对At信息,PlainText以及Image进行解析,但是总感觉这种实现不太优雅
      希望各位巨佬可以提供一些建议,谢谢

      1 Reply Last reply Reply Quote 0
      • Cookie_S
        Cookie_S last edited by

        This post is deleted!
        M 1 Reply Last reply Reply Quote 0
        • M
          MoeMegu @Cookie_S last edited by

          @cookie_s 并非使用子指令,而是在相同指令前缀后传入不同类型的参数,并根据对应类型处理

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

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