添加忽略复读QQ名单

This commit is contained in:
milimoe 2024-07-05 20:34:15 +08:00
parent 810120be92
commit 4105592845
Signed by: milimoe
GPG Key ID: 05D280912DA6C69E
2 changed files with 18 additions and 1 deletions

View File

@ -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]);

View File

@ -13,6 +13,8 @@ namespace Milimoe.RainBOT.Settings
/// </summary>
public static List<long> QQGroupIgnore { get; set; } = [];
public static List<long> 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<long>)value;
}
if (configs.TryGetValue("RepeatQQIgnore", out value) && value != null)
{
RepeatQQIgnore = (List<long>)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);