反向艾特添加忽略名单

This commit is contained in:
milimoe 2024-07-08 21:58:50 +08:00
parent d7e430f041
commit df48a747b4
Signed by: milimoe
GPG Key ID: 05D280912DA6C69E
3 changed files with 20 additions and 3 deletions

View File

@ -569,7 +569,7 @@ namespace Milimoe.RainBOT.ListeningTask
IEnumerable<AtMessage> temp_at = e.message.Where(m => m.type == "at").Cast<AtMessage>().Where(m => m.data.qq == $"{GeneralSettings.BotQQ}"); IEnumerable<AtMessage> temp_at = e.message.Where(m => m.type == "at").Cast<AtMessage>().Where(m => m.data.qq == $"{GeneralSettings.BotQQ}");
if (temp_at.Any()) if (temp_at.Any())
{ {
if (GeneralSettings.IsReverseAt && e.CheckThrow(GeneralSettings.PReverseAt, out dice)) if (GeneralSettings.IsReverseAt && !Ignore.ReverseAtIgnore.Contains(e.user_id) && e.CheckThrow(GeneralSettings.PReverseAt, out dice))
{ {
Bot.ColorfulCheckPass(sender, "反向艾特", dice, GeneralSettings.PReverseAt); Bot.ColorfulCheckPass(sender, "反向艾特", dice, GeneralSettings.PReverseAt);
foreach (AtMessage at in temp_at) foreach (AtMessage at in temp_at)

View File

@ -15,6 +15,8 @@ namespace Milimoe.RainBOT.Settings
public static List<long> RepeatQQIgnore { get; set; } = []; public static List<long> RepeatQQIgnore { get; set; } = [];
public static List<long> ReverseAtIgnore { get; set; } = [];
public static PluginConfig Configs { get; set; } = new("rainbot", "ignore"); public static PluginConfig Configs { get; set; } = new("rainbot", "ignore");
public static void InitIgnore() public static void InitIgnore()
@ -37,6 +39,10 @@ namespace Milimoe.RainBOT.Settings
{ {
RepeatQQIgnore = (List<long>)value; RepeatQQIgnore = (List<long>)value;
} }
if (configs.TryGetValue("ReverseAtIgnore", out value) && value != null)
{
ReverseAtIgnore = (List<long>)value;
}
} }
public static void SaveConfig() public static void SaveConfig()
@ -45,6 +51,7 @@ namespace Milimoe.RainBOT.Settings
Configs.Add("CallBrotherQQIgnore", CallBrotherQQIgnore); Configs.Add("CallBrotherQQIgnore", CallBrotherQQIgnore);
Configs.Add("QQGroupIgnore", QQGroupIgnore); Configs.Add("QQGroupIgnore", QQGroupIgnore);
Configs.Add("RepeatQQIgnore", RepeatQQIgnore); Configs.Add("RepeatQQIgnore", RepeatQQIgnore);
Configs.Add("ReverseAtIgnore", ReverseAtIgnore);
Configs.Save(); Configs.Save();
} }
@ -80,6 +87,13 @@ namespace Milimoe.RainBOT.Settings
else RepeatQQIgnore.Remove(lv); else RepeatQQIgnore.Remove(lv);
} }
break; break;
case "reverseatignore":
if (long.TryParse(strv, out lv))
{
if (isadd) ReverseAtIgnore.Add(lv);
else ReverseAtIgnore.Remove(lv);
}
break;
default: default:
return false; return false;
} }
@ -108,6 +122,9 @@ namespace Milimoe.RainBOT.Settings
case "repeatqqignore": case "repeatqqignore":
list = RepeatQQIgnore.Select(x => x.ToString()).ToList(); list = RepeatQQIgnore.Select(x => x.ToString()).ToList();
break; break;
case "reverseatignore":
list = ReverseAtIgnore.Select(x => x.ToString()).ToList();
break;
} }
string msg = list.Count > 0 ? "列表" + group + "拥有以下成员:" + "\r\n" + string.Join("\r\n", list) : "此列表不存在或没有任何成员。"; string msg = list.Count > 0 ? "列表" + group + "拥有以下成员:" + "\r\n" + string.Join("\r\n", list) : "此列表不存在或没有任何成员。";
_ = isgroup ? Bot.SendGroupMessage(target, "显示列表成员", msg) : Bot.SendFriendMessage(target, "显示列表成员", msg); _ = isgroup ? Bot.SendGroupMessage(target, "显示列表成员", msg) : Bot.SendFriendMessage(target, "显示列表成员", msg);

View File

@ -3,8 +3,8 @@
public class OSMCore public class OSMCore
{ {
public const string version = "v1.0"; public const string version = "v1.0";
public const string version2 = "Patch8 Test1"; public const string version2 = "Patch8 Test2";
public const string time = "July 6th, 2024"; public const string time = "July 8th, 2024";
public static string Info => $"OSM Core {version} {version2}\r\nAuthor: Milimoe\r\nBuilt on {time}\r\nSee: https://github.com/milimoe"; public static string Info => $"OSM Core {version} {version2}\r\nAuthor: Milimoe\r\nBuilt on {time}\r\nSee: https://github.com/milimoe";
} }