mamoe / mirai

高效率 QQ 机器人支持库
https://mirai.mamoe.net
GNU Affero General Public License v3.0
14.42k stars 2.54k forks source link

多行的很长群消息无法显示 #2407

Open hc5-github opened 1 year ago

hc5-github commented 1 year ago

问题描述

消息在后台显示已经发出去了,但是非常长的多行消息在群里不显示,然后我在数据库中把当天数据删除制造接口错误让机器人发送报错消息,只有三行的报错消息却发出去了

复现

发送一条比较长的多行群消息,纯文字,代码见补充信息

mirai-core 版本

Backend: version 2.13.2, built on 2022-12-05 01:50:53

bot-protocol

ANDROID_PHONE

其他组件版本

Plugins: HypixelCardRobot v11.4514, MCL Addon v2.1.1

系统日志

2022-12-27 16:46:21 I/main: Starting mirai-console...
2022-12-27 16:46:21 I/main:

==================================[ Mirai consosle 2.13.2 ]===================================
我是图标(字数限制65536删了)
2022-12-27 16:46:21 I/main: Backend: version 2.13.2, built on 2022-12-05 01:50:53.
2022-12-27 16:46:21 I/main: Frontend Terminal: version 2.13.2, provided by Mamoe Technologies
2022-12-27 16:46:21 I/main: Welcome to visit https://mirai.mamoe.net/
2022-12-27 16:46:22 W/stderr: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
2022-12-27 16:46:22 W/stderr: SLF4J: Defaulting to no-operation (NOP) logger implementation
2022-12-27 16:46:22 W/stderr: SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
2022-12-27 16:46:23 I/plugin: Successfully loaded plugin HypixelCardRobot v1.145
2022-12-27 16:46:23 I/plugin: Successfully loaded plugin MCL Addon v2.1.1
2022-12-27 16:46:24 I/main: Prepared built-in commands: autoLogin, help, login, logout, permission, status, stop
2022-12-27 16:46:24 I/HypixelCardRobot: HypixelCardRobot已启动
2022-12-27 16:46:24 I/HypixelCardRobot: DailyReport启动
2022-12-27 16:46:24 I/MCL Addon: iTXTech MCL Version: 2.1.2-61c8bd8
2022-12-27 16:46:24 W/MCL Addon: iTXTech Soyuz 未安装,Soyuz MCL Handler 特性已禁用
2022-12-27 16:46:24 I/main: 2 plugin(s) enabled.
2022-12-27 16:46:24 I/main: Auto-login 3590577402, protocol: ANDROID_PHONE, heartbeatStrategy: STAT_HB
2022-12-27 16:46:25 W/stderr: ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...
2022-12-27 16:46:26 I/Bot.3590577402: Loaded account secrets from local cache.
2022-12-27 16:46:26 I/Bot.3590577402: Saved account secrets to local cache for fast login.
2022-12-27 16:46:26 I/Bot.3590577402: Login successful.
2022-12-27 16:46:27 V/Bot.3590577402: Event: BotOnlineEvent(bot=Bot(3590577402))
2022-12-27 16:46:27 I/Bot.3590577402: Bot login successful.
2022-12-27 16:46:27 I/main: mirai-console started successfully.
2022-12-27 16:47:00 I/HypixelCardRobot: 正在拉取每日总结中
> WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.alibaba.fastjson2.util.JDKUtils (file:/ProjectBin/CardRobot/CardRobot/mcl.jar) to field java.lang.String.COMPACT_STRINGS
WARNING: Please consider reporting this to the maintainers of com.alibaba.fastjson2.util.JDKUtils
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2022-12-27 16:47:04 V/Bot.3590577402: Group(756696025) <- ❀茶话会今日数据❀\n❀公会经验:37098807(+363052)\n❀等级:Lv.19(+0)\n❀活跃人数:41人(-8)\n❀今日榜首:Afory(37998xp)\n❀榜首经验相比昨日:-54178xp\n❀前五名相比昨日增加:-177254xp\n❀今日贡献排行榜:\n1.Afory - 37998 | 2.No1q - 34585\n3.CuteAritm - 37998 | 4._True_L0ve_ - 34585\n5.Severle - 37998 | 6._N0way - 34585\n7.ImFrain - 37998 | 8.SP66_ - 34585\n9.ganyuuu - 37998 | X.f_v_v - 34585\n新的一天统计已经开始啦~抓紧努力哦~~~~
2022-12-27 16:47:10 I/HypixelCardRobot: 正在拉取每日总结中
2022-12-27 16:47:13 V/Bot.3590577402: Group(756696025) <- ❀茶话会今日数据❀\n❀公会经验:37098807(+363052)\n❀等级:Lv.19(+0)\n❀活跃人数:41人(-8)\n❀今日榜首:Afory(37998xp)\n❀榜首经验相比昨日:-54178xp\n❀前五名相比昨日增加:-177254xp\n❀今日贡献排行榜:\n1.Afory - 37998 | 2.No1q - 34585\n3.CuteAritm - 37998 | 4._True_L0ve_ - 34585\n5.Severle - 37998 | 6._N0way - 34585\n7.ImFrain - 37998 | 8.SP66_ - 34585\n9.ganyuuu - 37998 | X.f_v_v - 34585\n新的一天统计已经开始啦~抓紧努力哦~~~~
2022-12-27 16:47:20 I/HypixelCardRobot: 正在拉取每日总结中
2022-12-27 16:47:23 V/Bot.3590577402: Group(756696025) <- ❀茶话会今日数据❀\n❀公会经验:37098807(+363052)\n❀等级:Lv.19(+0)\n❀活跃人数:41人(-8)\n❀今日榜首:Afory(37998xp)\n❀榜首经验相比昨日:-54178xp\n❀前五名相比昨日增加:-177254xp\n❀今日贡献排行榜:\n1.Afory - 37998 | 2.No1q - 34585\n3.CuteAritm - 37998 | 4._True_L0ve_ - 34585\n5.Severle - 37998 | 6._N0way - 34585\n7.ImFrain - 37998 | 8.SP66_ - 34585\n9.ganyuuu - 37998 | X.f_v_v - 34585\n新的一天统计已经开始啦~抓紧努力哦~~~~
2022-12-27 16:47:30 I/HypixelCardRobot: 正在拉取每日总结中
2022-12-27 16:47:30 V/Bot.3590577402: Group(756696025) <- 系统异常!公会日报生成失败!\n返回code - -1\n系统消息 - 该日期无数据
>
2022-12-27 16:47:34 V/Bot.3590577402: Event: BotOfflineEvent.Active(bot=Bot(3590577402), cause=null, reconnect=false)
2022-12-27 16:47:34 I/Bot.3590577402: Bot is closed manually
2022-12-27 16:47:34 I/Bot.3590577402: Bot cancelled: Job was cancelled
SUPERCONSOLE root  >>

网络日志

见补充信息

补充信息

网络日志: http://103.222.191.171:666/netlog.log 正常消息(就是发不出去的消息)模板: image 接口报错消息(发出去的三行的): image 插件代码:

public void run() {
                SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
                Date date = new Date(System.currentTimeMillis());
                String time = formatter.format(date);
                com.teatalk.msdosadmin.cr.HypixelCardRobot.INSTANCE.getLogger().info("������ȡÿ���ܽ���");
                Bot bot = Bot.getInstances().get(0);
                try {
                    HttpClient client = HttpClient.newHttpClient();
                    HttpRequest request = HttpRequest.newBuilder().uri(URI.create("http://�ӿڵ�ַ�����㿴/api/stats?date="+time)).build();
                    HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
                    String resp = response.body();
                    JSONObject json = new JSONObject().parseObject(resp);
                    if(json.getString("code").equals("114514")){
                        Date today = new Date(System.currentTimeMillis() - 1000 * 60 * 60 * 24);
                        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
                        String yesterday = simpleDateFormat.format(today);
                        HttpClient client1 = HttpClient.newHttpClient();
                        HttpRequest request1 = HttpRequest.newBuilder().uri(URI.create("http://�ӿڵ�ַ�����㿴/api/stats/contrast?newdate="+time+"&&olddate="+yesterday)).build();
                        HttpResponse<String> response1 = client1.send(request1, HttpResponse.BodyHandlers.ofString());
                        String resp1 = response1.body();
                        JSONObject json1 = new JSONObject().parseObject(resp1);
                        if(json1.getString("code").equals("114514")){
                            DecimalFormat df = new DecimalFormat("#.###");
                            long now_exp = json.getJSONObject("stats").getLongValue("exp");
                            int add_exp = json1.getJSONObject("result").getJSONObject("basic").getIntValue("exp_up");
                            long level = (now_exp - 17500000)/3000000 + 13;
                            long add_level = add_exp / 3000000;
                            int activity = json.getJSONObject("stats").getIntValue("activity");
                            int add_activity = json1.getJSONObject("result").getJSONObject("basic").getIntValue("activity_up");
                            String aas;
                            if(add_activity >=0){
                                aas = "+"+add_activity;
                            }else{
                                aas = ""+add_activity;
                            }
                            String top1_name = json.getJSONObject("stats").getString("top1_name");
                            int top1_xp = json.getJSONObject("stats").getIntValue("top1_xp");
                            int top1_add_int = json1.getJSONObject("result").getJSONObject("top").getIntValue("top1_exp_up");
                            String top1_add;
                            if(top1_add_int >=0){
                                top1_add = "+"+top1_add_int;
                            }else{
                                top1_add = ""+top1_add_int;
                            }
                            int top11_add_int = json1.getJSONObject("result").getJSONObject("top").getIntValue("top12345_exp_up");
                            String top11_add;
                            if(top11_add_int >=0){
                                top11_add = "+"+top11_add_int;
                            }else{
                                top11_add = ""+top11_add_int;
                            }
                            bot.getGroup(756696025).sendMessage("?�軰���������?"+newLine+
                                    "?���ᾭ�飺"+now_exp+"��+"+add_exp+"��"+newLine+
                                    "?�ȼ���Lv."+level+"��+"+add_level+"��"+newLine+
                                    "?��Ծ������"+activity+"�ˣ�"+aas+"��"+newLine+
                                    "?���հ��ף�"+top1_name+"��"+top1_xp+"xp��"+newLine+
                                    "?���׾���������գ�"+top1_add+"xp"+newLine+
                                    "?ǰ��������������ӣ�"+top11_add+"xp"+newLine+
                                    "?���չ������а�"+newLine+
                                    "1."+json.getJSONObject("stats").getString("top1_name")+" - "+json.getJSONObject("stats").getIntValue("top1_xp")+" | 2."+json.getJSONObject("stats").getString("top2_name")+" - "+json.getJSONObject("stats").getIntValue("top2_xp")+newLine+
                                    "3."+json.getJSONObject("stats").getString("top3_name")+" - "+json.getJSONObject("stats").getIntValue("top1_xp")+" | 4."+json.getJSONObject("stats").getString("top4_name")+" - "+json.getJSONObject("stats").getIntValue("top2_xp")+newLine+
                                    "5."+json.getJSONObject("stats").getString("top5_name")+" - "+json.getJSONObject("stats").getIntValue("top1_xp")+" | 6."+json.getJSONObject("stats").getString("top6_name")+" - "+json.getJSONObject("stats").getIntValue("top2_xp")+newLine+
                                    "7."+json.getJSONObject("stats").getString("top7_name")+" - "+json.getJSONObject("stats").getIntValue("top1_xp")+" | 8."+json.getJSONObject("stats").getString("top8_name")+" - "+json.getJSONObject("stats").getIntValue("top2_xp")+newLine+
                                    "9."+json.getJSONObject("stats").getString("top9_name")+" - "+json.getJSONObject("stats").getIntValue("top1_xp")+" | X."+json.getJSONObject("stats").getString("top10_name")+" - "+json.getJSONObject("stats").getIntValue("top2_xp")+newLine+
                                    "�µ�һ��ͳ���Ѿ���ʼ��~ץ��Ŭ��Ŷ~~~~");
                        }else{
                            bot.getGroup(756696025).sendMessage("ϵͳ�쳣�������ձ�����ʧ�ܣ�"+newLine+"����code - "+json1.getString("code")+newLine+"ϵͳ��Ϣ - "+json1.getString("msg"));
                        }
                    }else{
                        bot.getGroup(756696025).sendMessage("ϵͳ�쳣�������ձ�����ʧ�ܣ�"+newLine+"����code - "+json.getString("code")+newLine+"ϵͳ��Ϣ - "+json.getString("msg"));
                    }
                }catch(IOException e){
                    bot.getGroup(756696025).sendMessage("ϵͳ�쳣�������ձ�����ʧ�ܣ�");
                }catch(InterruptedException e){
                    bot.getGroup(756696025).sendMessage("�޷������������ݷ������������ձ�����ʧ�ܣ�");
                }
            }

http://103.222.191.171:666/114514.java 不要DDOS求你了求你了求求了!弄一个服务器很不容易的! 插件依赖:fastjson2 代码在预览里面可能会出问题,可以拿去格式化一下

cssxsh commented 1 year ago

github 可以上传附件 没必要挂个服务器直链

hc5-github commented 1 year ago

github 可以上传附件 没必要挂个服务器直链

刚用Github找不到awa

Him188 commented 1 year ago

看了你的日志,

2022-12-27 16:43:42 W/Net 3590577402: An exception was thrown during 'loading groups' of Bot 3590577402. Trying to ignore the error and continue logging in...
StateSwitchingException(old=StateLoading, new=StateClosed, cause=net.mamoe.mirai.internal.network.impl.ForceOfflineException: ���QQ����16:38�ڡ�BKK-AL10���豸��¼����ǰ�豸�����ߡ�����ⲻ���㱾�˲�������ô���QQ��������Ѿ�й¶���뾡�����µ�¼���޸����롣)

你的 bot 看起来是异地登录被挤掉了, 所以你的消息看起来是在服务器上有一些同步问题导致服务器对发送请求返回了成功但实际上并没有发送.