添加新指令

This commit is contained in:
milimoe 2025-06-04 01:17:06 +08:00
parent 472d0cec79
commit a9f0c7f6f1
Signed by: milimoe
GPG Key ID: 05D280912DA6C69E
2 changed files with 17 additions and 1 deletions

View File

@ -176,6 +176,7 @@ namespace Oshima.FunGame.WebAPI
builder.Services.AddScoped<RainBOTService>(); builder.Services.AddScoped<RainBOTService>();
builder.Services.AddScoped<FunGameController>(); builder.Services.AddScoped<FunGameController>();
builder.Services.AddScoped<QQController>(); builder.Services.AddScoped<QQController>();
builder.Services.AddScoped<TestController>();
builder.Services.AddTransient(provider => builder.Services.AddTransient(provider =>
{ {
SQLHelper? sql = Factory.OpenFactory.GetSQLHelper(); SQLHelper? sql = Factory.OpenFactory.GetSQLHelper();

View File

@ -12,7 +12,7 @@ using Oshima.FunGame.WebAPI.Models;
namespace Oshima.FunGame.WebAPI.Services namespace Oshima.FunGame.WebAPI.Services
{ {
public class RainBOTService(FunGameController controller, QQController qqcontroller, QQBotService service, ILogger<RainBOTService> logger, IMemoryCache memoryCache) public class RainBOTService(FunGameController controller, QQController qqcontroller, QQBotService service, ILogger<RainBOTService> logger, IMemoryCache memoryCache, TestController testController)
{ {
private static List<string> FunGameItemType { get; } = ["卡包", "武器", "防具", "鞋子", "饰品", "消耗品", "魔法卡", "收藏品", "特殊物品", "任务物品", "礼包", "其他"]; private static List<string> FunGameItemType { get; } = ["卡包", "武器", "防具", "鞋子", "饰品", "消耗品", "魔法卡", "收藏品", "特殊物品", "任务物品", "礼包", "其他"];
private bool FunGameSimulation { get; set; } = false; private bool FunGameSimulation { get; set; } = false;
@ -21,6 +21,7 @@ namespace Oshima.FunGame.WebAPI.Services
private QQBotService Service { get; } = service; private QQBotService Service { get; } = service;
private ILogger<RainBOTService> Logger { get; } = logger; private ILogger<RainBOTService> Logger { get; } = logger;
private IMemoryCache MemoryCache { get; set; } = memoryCache; private IMemoryCache MemoryCache { get; set; } = memoryCache;
private TestController TestController { get; set; } = testController;
private async Task SendAsync(IBotMessage msg, string title, string content, int msgType = 0, object? media = null, int? msgSeq = null) private async Task SendAsync(IBotMessage msg, string title, string content, int msgType = 0, object? media = null, int? msgSeq = null)
{ {
@ -105,6 +106,20 @@ namespace Oshima.FunGame.WebAPI.Services
return true; return true;
} }
if (e.Detail == "查询服务器启动时间")
{
string msg = NetworkUtility.JsonDeserialize<string>(TestController.GetLastLoginTime()) ?? "";
await SendAsync(e, "查询服务器启动时间", msg);
return true;
}
if (e.Detail.StartsWith("查询任务计划"))
{
string msg = NetworkUtility.JsonDeserialize<string>(TestController.GetTaskScheduler(e.Detail.Replace("查询任务计划", ""))) ?? "";
await SendAsync(e, "查询任务计划", msg);
return true;
}
if (e.Detail == "帮助" || e.Detail == "帮助1") if (e.Detail == "帮助" || e.Detail == "帮助1")
{ {
await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 1 / 7 页) await SendAsync(e, "饭给木", @"《饭给木》游戏指令列表(第 1 / 7 页)