MiraiForum

    • 注册
    • 登录
    • 搜索
    • 热门
    • 最新
    • 未解决
    • 标签
    • 群组
    • 友情链接
    1. 主页
    2. abc408880155
    • 资料
    • 关注 0
    • 粉丝 0
    • 主题 0
    • 帖子 18
    • 最佳 0
    • 有争议的 0
    • 群组 0

    abc408880155

    @abc408880155

    0
    声望
    4
    资料浏览
    18
    帖子
    0
    粉丝
    0
    关注
    注册时间 最后登录

    abc408880155 取消关注 关注

    abc408880155 发布的最新帖子

    • RE: 如何去掉引用回复的 @TA?

      @2446694 之前没注意到你回复的是聊天记录,我说的都是单纯的回复群消息

      public static void sendGroupMessage(List<Long> groupIDs, Object message) {
      for (Long groupID : groupIDs) {
      try {
      Group group = bot.getGroup(groupID);
      if (message instanceof MessageChain) {
      group.sendMessage((MessageChain) message);
      } else if (message instanceof String) {
      group.sendMessage((String) message);
      } else {
      log.error("Invalid message type: {}", message.getClass().getName());
      }
      } catch (NullPointerException e) {
      log.error("Failed to send message to group {} - group is null: {}", groupID, e.getMessage());
      } catch (IllegalStateException e) {
      log.error("Failed to send message to group {} - account may be blocked: {}", groupID, e.getMessage());
      } catch (Exception e) {
      log.error("Failed to send message to group {}: {}", groupID, e.getMessage());
      }
      }
      }
      
      发布在 开发交流
      abc408880155
      abc408880155
    • RE: 如何去掉引用回复的 @TA?

      @2446694 怪了,我的安卓手机Q版本为8.9.50.10650,但没出现过多余@TA,Bot登陆协议为watch

      发布在 开发交流
      abc408880155
      abc408880155
    • RE: 如何去掉引用回复的 @TA?

      @2446694 不清楚,不过的确会出现这种情况,但和你又有点不一样,Mac端偶尔会出现多余的艾特,iPhone和Android从没出现过。似乎只是单纯的显示问题。

      图一 Mac
      6d2d3440854254b50981dce4f9addaa7.png

      图二 iPhone
      5d432265e4d69d2b2ad05fbedeb10b8e.png

      发布在 开发交流
      abc408880155
      abc408880155
    • RE: 如何去掉引用回复的 @TA?
      public static QuoteReply getQuoteReply(MessageEvent event) {
          return new QuoteReply(event.getMessage());
      }
      
      发布在 开发交流
      abc408880155
      abc408880155
    • RE: 如何去掉引用回复的 @TA?

      @2446694 我这样没有出现多余的艾特

      public static MessageChain quoteReply(MessageEvent event, MessageChain msg) {
      return buildMessageChain(getQuoteReply(event), msg);
      }
      public static MessageChain quoteReply(MessageEvent event, String msg) {
      return buildMessageChain(getQuoteReply(event), msg);
      }

      发布在 开发交流
      abc408880155
      abc408880155
    • RE: 安卓手表协议监听不到撤回消息吗

      手表协议不行,撤回事件不行,只能监听到消息事件

      发布在 开发交流
      abc408880155
      abc408880155
    • RE: Spring Boot maven工程如何实现扫码登录?

      @2446694 谢谢!

      发布在 开发交流
      abc408880155
      abc408880155
    • RE: Spring Boot maven工程如何实现扫码登录?

      @cssxsh nice……之前一直没看到这个,谢啦

      发布在 开发交流
      abc408880155
      abc408880155
    • RE: Spring Boot maven工程如何实现扫码登录?

      不明白前端,我还只简单学了学Java,研究了下mirai给的说明。不过,它的二维码图片估计得看他的源码是怎么发出来的,复写下应该可以。你如果折腾明白了,麻烦转告我下

      发布在 开发交流
      abc408880155
      abc408880155
    • RE: Spring Boot maven工程如何实现扫码登录?

      非程序员,医学生,我是这么写的代码,你可以参考,可扫码,可短信验证登陆,基于目前的2.15.0-M1: public static void login(Long botAccount, String botPassword) {
      Configuration config = ConfigManager.getConfig();

          ClassLoader loader = Thread.currentThread().getContextClassLoader();
          Thread.currentThread().setContextClassLoader(GlobalEventChannel.class.getClassLoader());
      
          boolean loginByQR = config.getBoolean("loginByQR");
          File workingDir = new File(ConfigManager.pluginDirectory, "bot");
      
          if(!workingDir.exists()) workingDir.mkdirs();
      
      
          BotFactory.BotConfigurationLambda botConfigurationLambda = botConfiguration -> {
              botConfiguration.setWorkingDir(workingDir);
              if (config.getBoolean("redirectBotLogToDirectory")) {
                  botConfiguration.redirectBotLogToDirectory();
              }
              if (config.getBoolean("noNetworkLog")) {
                  botConfiguration.noNetworkLog();
              }
              if (config.getBoolean("noBotLog")) {
                  botConfiguration.noBotLog();
              }
              botConfiguration.setProtocol(BotConfiguration.MiraiProtocol.valueOf(config.getString("bot-login-device")));
              botConfiguration.setCacheDir(new File("cache"));
              botConfiguration.fileBasedDeviceInfo();
              File deviceFile = new File(botConfiguration.getWorkingDir(), "device.json");
              if (deviceFile.exists()) {
                  botConfiguration.setDeviceInfo(bot1 -> DeviceInfo.from(deviceFile));
              }
          };
      
          bot = loginByQR ? BotFactory.INSTANCE.newBot(botAccount, BotAuthorization.byQRCode(), botConfigurationLambda) :
                  BotFactory.INSTANCE.newBot(botAccount, botPassword, new BotConfiguration() {{
                      setWorkingDir(workingDir);
                      if (config.getBoolean("redirectBotLogToDirectory")) {
                          redirectBotLogToDirectory();
                      }
                      if (config.getBoolean("noNetworkLog")) {
                          noNetworkLog();
                      }
                      if (config.getBoolean("noBotLog")) {
                          noBotLog();
                      }
      
                      //FixProtocolVersion.update();
                      setProtocol(MiraiProtocol.valueOf(config.getString("bot-login-device")));
      
                      setCacheDir(new File("cache"));
                      fileBasedDeviceInfo();
                      File deviceFile = new File(getWorkingDir(), "device.json");
                      if (deviceFile.exists()) {
                          setDeviceInfo(bot1 -> DeviceInfo.from(deviceFile));
                      }
                  }});
      
          bot.login();
          Thread.currentThread().setContextClassLoader(loader);
      }
      
      发布在 开发交流
      abc408880155
      abc408880155