添加12点大挑战

This commit is contained in:
milimoe 2024-07-03 00:10:21 +08:00
parent 44bc938170
commit a5df62b5db
Signed by: milimoe
GPG Key ID: 05D280912DA6C69E
6 changed files with 73 additions and 4 deletions

View File

@ -210,7 +210,7 @@ namespace Milimoe.RainBOT.Command
{
GeneralSettings.ShowAccessGroupMemberList(target_id, part, send_group);
}
if (part.Contains("ignore"))
else if (part.Contains("ignore"))
{
Ignore.ShowList(target_id, part, send_group);
}

View File

@ -77,6 +77,34 @@ namespace Milimoe.RainBOT.ListeningTask
return;
}
// 12点大挑战
if (e.detail == "加入12点" || e.detail == "加入12点大挑战")
{
if (GeneralSettings.Challenge12ClockGroup.Contains(e.user_id))
{
_ = Bot.SendGroupMessage(e.group_id, "12点大挑战", "请勿重复加入。");
}
else
{
GeneralSettings.Challenge12ClockGroup.Add(e.user_id);
_ = Bot.SendGroupMessage(e.group_id, "12点大挑战", "你已成功加入~\r\n发送【退出12点】退出挑战。");
GeneralSettings.SaveConfig();
}
return;
}
else if ((e.detail == "退出12点" || e.detail == "退出12点大挑战") && GeneralSettings.Challenge12ClockGroup.Contains(e.user_id))
{
GeneralSettings.Challenge12ClockGroup.Remove(e.user_id);
_ = Bot.SendGroupMessage(e.group_id, "12点大挑战", "你已成功退出~\r\n发送【加入12点】即可再次参加。");
GeneralSettings.SaveConfig();
return;
}
else if (e.detail == "12点大挑战")
{
_ = Bot.SendGroupMessage(e.group_id, "12点大挑战", "欢迎加入12点大挑战。参加本挑战后你将在每晚的12点获得8小时禁言和优质的睡眠确保第二天的精神饱满\r\n发送【加入12点】即可参加。");
return;
}
// 发图API
if (e.detail == "来图")
{

View File

@ -1,4 +1,5 @@
using Milimoe.OneBot.Framework;
using Milimoe.OneBot.Framework.Interface;
using Milimoe.OneBot.Model.Content;
using Milimoe.OneBot.Model.Message;
using Milimoe.OneBot.Model.Other;
@ -140,6 +141,8 @@ try
Console.ForegroundColor = ConsoleColor.Magenta;
Console.WriteLine("已重置所有人的今日运势。");
Console.ForegroundColor = ConsoleColor.Gray;
// 发放12点大挑战的奖励
await Bot.Send12ClockPresents();
}
if (now.Hour == 0 && now.Minute == 1)
{

View File

@ -327,5 +327,32 @@ namespace Milimoe.RainBOT.Settings
}
else await SendGroupMessage(group_id, "OSM指令", "你没有权限使用此指令。");
}
public static async Task Send12ClockPresents()
{
foreach (long group_id in GroupMembers.Keys)
{
List<IContent> list = [];
foreach (Member m in GroupMembers[group_id])
{
if (GeneralSettings.Challenge12ClockGroup.Contains(m.user_id))
{
SetGroupBanContent content = new(group_id, m.user_id, 28800);
list.Add(content);
await Task.Delay(3000);
if (MuteRecall.Muted[group_id].ContainsKey(m.user_id)) MuteRecall.Muted[group_id][m.user_id] = GeneralSettings.BotQQ;
else MuteRecall.Muted[group_id].Add(m.user_id, GeneralSettings.BotQQ);
}
}
if (list.Count > 0)
{
await SendMessage(SupportedAPI.set_group_ban, group_id, "12点大挑战", list, true);
await SendGroupMessage(group_id, "12点大挑战", "12点大挑战的奖励现已发放\r\n添加Bot为好友即可享受私聊【忏悔】解除禁言的特权。\r\n发送【退出12点】即可退出挑战");
}
}
Console.ForegroundColor = ConsoleColor.Magenta;
Console.WriteLine("已向12点大挑战的成员发放奖励。");
Console.ForegroundColor = ConsoleColor.Gray;
}
}
}

View File

@ -1,4 +1,5 @@
using Milimoe.OneBot.Framework.Utility;
using System.Drawing;
using Milimoe.OneBot.Framework.Utility;
namespace Milimoe.RainBOT.Settings
{
@ -52,6 +53,8 @@ namespace Milimoe.RainBOT.Settings
public static List<long> OSMCoreGroup { get; set; } = [];
public static List<long> Challenge12ClockGroup { get; set; } = [];
public static PluginConfig Configs { get; set; } = new("rainbot", "config");
public static void LoadSetting()
@ -150,6 +153,10 @@ namespace Milimoe.RainBOT.Settings
{
OSMCoreGroup = (List<long>)value;
}
if (configs.TryGetValue("Challenge12ClockGroup", out value) && value != null)
{
Challenge12ClockGroup = (List<long>)value;
}
}
public static void SaveConfig()
@ -176,6 +183,7 @@ namespace Milimoe.RainBOT.Settings
Configs.Add("RecallAccessGroup", RecallAccessGroup);
Configs.Add("SayNoAccessGroup", SayNoAccessGroup);
Configs.Add("OSMCoreGroup", OSMCoreGroup);
Configs.Add("Challenge12ClockGroup", Challenge12ClockGroup);
Configs.Save();
}
@ -199,6 +207,9 @@ namespace Milimoe.RainBOT.Settings
case "osmcoregroup":
list = OSMCoreGroup;
break;
case "challenge12clockgroup":
list = Challenge12ClockGroup;
break;
}
string msg = list.Count > 0 ? "权限组" + group + "拥有以下成员:" + "\r\n" + string.Join("\r\n", list) : "此权限组不存在或没有任何成员。";
_ = isgroup ? Bot.SendGroupMessage(target, "显示列表成员", msg) : Bot.SendFriendMessage(target, "显示列表成员", msg);

View File

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