Skip to content

Commit

Permalink
修改看板娘消息上限消息
Browse files Browse the repository at this point in the history
  • Loading branch information
LittleFish-233 committed Aug 18, 2023
1 parent 0075dbf commit 207f10e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 8 deletions.
Expand Up @@ -33,6 +33,8 @@ public enum RobotEventType
[Display(Name = "固定时间")]
FixedTime,
[Display(Name = "概率触发")]
PreTime
PreTime,
[Display(Name = "条件触发")]
ConditionalTriggering
}
}
Expand Up @@ -26,10 +26,13 @@ else
<MCol Cols="12" Md="6">
<CnGalWebSite.Components.Inputs.MasaSelecte @bind-Value="Model.Type" Label="类型" TValue="RobotEventType" />
</MCol>
@if (Model.Type != RobotEventType.ConditionalTriggering)
{
<MCol Cols="12" Md="6">
<CnGalWebSite.Components.Inputs.MasaDatePicker @bind-Value="Model.Time" ShowDate="false" Label="开始触发时间" />
</MCol>
}

<MCol Cols="12" Md="6">
<CnGalWebSite.Components.Inputs.MasaDatePicker @bind-Value="Model.Time" ShowDate="false" Label="开始触发时间" />
</MCol>

@if (Model.Type == RobotEventType.PreTime)
{
Expand Down
10 changes: 9 additions & 1 deletion CnGalWebSite/CnGalWebSite.RobotClientX/Pages/Admin/Events.razor
Expand Up @@ -15,7 +15,15 @@
}
else if (context.Header.Value == nameof(RobotEvent.Time))
{
@context.Item.Time.ToString("HH:mm:ss")
@if (context.Item.Type == RobotEventType.ConditionalTriggering)
{
@("")
}
else
{
@context.Item.Time.ToString("HH:mm:ss")
}

}
else if (context.Header.Value == nameof(RobotEvent.IsHidden))
{
Expand Down
Expand Up @@ -18,6 +18,7 @@ namespace CnGalWebSite.RobotClientX.Services.QQClients
public class QQClientService : IQQClientService, IDisposable
{
private readonly IRepository<RobotGroup> _robotGroupRepository;
private readonly IRepository<RobotEvent> _robotEventRepository;
private readonly IRepository<PostLog> _postLogRepository;
private readonly IConfiguration _configuration;
private readonly IMessageService _messageService;
Expand All @@ -32,14 +33,15 @@ public class QQClientService : IQQClientService, IDisposable

public QQClientService(IRepository<RobotGroup> robotGroupRepository, IRepository<PostLog> postLogRepository,
IConfiguration configuration, ILogger<QQClientService> logger, IEventService eventService,
IMessageService messageService)
IMessageService messageService, IRepository<RobotEvent> robotEventRepository)
{
_robotGroupRepository = robotGroupRepository;
_configuration = configuration;
_messageService = messageService;
_postLogRepository = postLogRepository;
_logger = logger;
_eventService = eventService;
_robotEventRepository = robotEventRepository;
}

public void InitMasuda()
Expand Down Expand Up @@ -216,7 +218,7 @@ public async Task Init()
};
}

_logger.LogInformation("CnGal资料站 看板娘 v3.4.5");
_logger.LogInformation("CnGal资料站 看板娘 v3.4.6");

}

Expand Down Expand Up @@ -382,13 +384,16 @@ private async Task<bool> CheckLimit(RobotReplyRange range, long sendto, long mem
//检查上限
if (singleCount == singleLimit)
{
await SendMessage(range, sendto, $"[image=https://image.cngal.org/kanbanFace/hhzywx.png][@{memberId}]如果恶意骚扰人家的话,我会请你离开哦…", msg);
SendMessageModel result = await _messageService.ProcMessageAsync(range, _robotEventRepository.GetAll().FirstOrDefault(s => s.Note == "消息上限警告")?.Text ?? $"[image=https://image.cngal.org/kanbanFace/hhzywx.png][@{memberId}]如果恶意骚扰人家的话,我会请你离开哦…", null, null, memberId, memberName);
result.SendTo = sendto;
await SendMessage(result, msg);
return true;
}

if (totalCount == totalLimit)
{
SendMessageModel result = await _messageService.ProcMessageAsync(range, $"核心温度过高,正在冷却......", null, null, memberId, memberName);
result.SendTo = sendto;
await SendMessage(result, msg);
return true;
}
Expand Down

0 comments on commit 207f10e

Please sign in to comment.