From 4105592845fd7c06193662c71a16d0ed787215dc Mon Sep 17 00:00:00 2001 From: milimoe Date: Fri, 5 Jul 2024 20:34:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BF=BD=E7=95=A5=E5=A4=8D?= =?UTF-8?q?=E8=AF=BBQQ=E5=90=8D=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ListeningTask/GroupMessageTask.cs | 2 +- src/Settings/Ignore.cs | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/ListeningTask/GroupMessageTask.cs b/src/ListeningTask/GroupMessageTask.cs index c861af3..690f95c 100644 --- a/src/ListeningTask/GroupMessageTask.cs +++ b/src/ListeningTask/GroupMessageTask.cs @@ -589,7 +589,7 @@ namespace Milimoe.RainBOT.ListeningTask } // 随机复读 - if (GeneralSettings.IsRepeat && !Ignore.RepeatIgnore.Any(e.detail.Contains) && e.CheckThrow(GeneralSettings.PRepeat, out dice)) + if (GeneralSettings.IsRepeat && !Ignore.RepeatIgnore.Any(e.detail.Contains) && !Ignore.RepeatQQIgnore.Contains(e.user_id) && e.CheckThrow(GeneralSettings.PRepeat, out dice)) { // 出现了@at就直接触发复读,没有延迟 int delay = e.message.Where(m => m.type == "at").Any() ? 0 : GeneralSettings.RepeatDelay[0] + new Random().Next(GeneralSettings.RepeatDelay[1] - GeneralSettings.RepeatDelay[0]); diff --git a/src/Settings/Ignore.cs b/src/Settings/Ignore.cs index 2a9fc59..f152d70 100644 --- a/src/Settings/Ignore.cs +++ b/src/Settings/Ignore.cs @@ -13,6 +13,8 @@ namespace Milimoe.RainBOT.Settings /// public static List QQGroupIgnore { get; set; } = []; + public static List RepeatQQIgnore { get; set; } = []; + public static PluginConfig Configs { get; set; } = new("rainbot", "ignore"); public static void InitIgnore() @@ -31,6 +33,10 @@ namespace Milimoe.RainBOT.Settings { QQGroupIgnore = (List)value; } + if (configs.TryGetValue("RepeatQQIgnore", out value) && value != null) + { + RepeatQQIgnore = (List)value; + } } public static void SaveConfig() @@ -38,6 +44,7 @@ namespace Milimoe.RainBOT.Settings Configs.Add("RepeatIgnore", RepeatIgnore); Configs.Add("CallBrotherQQIgnore", CallBrotherQQIgnore); Configs.Add("QQGroupIgnore", QQGroupIgnore); + Configs.Add("RepeatQQIgnore", RepeatQQIgnore); Configs.Save(); } @@ -66,6 +73,13 @@ namespace Milimoe.RainBOT.Settings else QQGroupIgnore.Remove(lv); } break; + case "repeatqqignore": + if (long.TryParse(strv, out lv)) + { + if (isadd) RepeatQQIgnore.Add(lv); + else RepeatQQIgnore.Remove(lv); + } + break; default: return false; } @@ -91,6 +105,9 @@ namespace Milimoe.RainBOT.Settings case "qqgroupignore": list = QQGroupIgnore.Select(x => x.ToString()).ToList(); break; + case "repeatqqignore": + list = RepeatQQIgnore.Select(x => x.ToString()).ToList(); + break; } string msg = list.Count > 0 ? "列表" + group + "拥有以下成员:" + "\r\n" + string.Join("\r\n", list) : "此列表不存在或没有任何成员。"; _ = isgroup ? Bot.SendGroupMessage(target, "显示列表成员", msg) : Bot.SendFriendMessage(target, "显示列表成员", msg);