QQ机器人
This commit is contained in:
parent
f40c0453eb
commit
500202946d
@ -123,23 +123,19 @@ namespace asg_form.Controllers
|
||||
{
|
||||
using(TestDbContext testDb = new TestDbContext()) {
|
||||
var user = await userManager.FindByNameAsync(this.User.Identity!.Name!);
|
||||
if (user.officium != "Anchor")
|
||||
{
|
||||
return Ok(new error_mb { code = 401, message = $"你是{user.officium},你不是导播,无法操作" });
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
//对testDb.team_Games.commentary中出现最多的十个解说名称进行排名
|
||||
var ranking = testDb.team_Games.SelectMany(g => JsonConvert.DeserializeObject<List<com_json>>(g.commentary).Select(c => c.chinaname))
|
||||
var ranking = testDb.team_Games.ToList();
|
||||
var ranking1= ranking.SelectMany(g => JsonConvert.DeserializeObject<List<com_json>>(g.commentary).Select(c => c.chinaname))
|
||||
.GroupBy(c => c)
|
||||
.OrderByDescending(g => g.Count())
|
||||
.Take(10)
|
||||
.Select(g => new { Name = g.Key, Count = g.Count() })
|
||||
.ToList();
|
||||
|
||||
return ranking;
|
||||
return ranking1;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,6 @@ using asg_form.Controllers;
|
||||
using asg_form.Controllers.Hubs;
|
||||
using Flandre.Adapters.OneBot.Extensions;
|
||||
using Flandre.Framework;
|
||||
using IGeekFan.AspNetCore.Knife4jUI;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
@ -33,7 +33,6 @@
|
||||
<PackageReference Include="EPPlus" />
|
||||
<PackageReference Include="Flandre.Adapters.OneBot.Extensions" />
|
||||
<PackageReference Include="Flandre.Core" />
|
||||
<PackageReference Include="IGeekFan.AspNetCore.Knife4jUI" />
|
||||
<PackageReference Include="MailKit" />
|
||||
<PackageReference Include="Masuit.Tools.Abstractions" />
|
||||
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" />
|
||||
|
@ -38,9 +38,6 @@ namespace asg_form
|
||||
[EventName("查询选手")]
|
||||
public class qqbot:Plugin
|
||||
{
|
||||
|
||||
|
||||
|
||||
[Command]
|
||||
public string 查询选手(string name)
|
||||
{
|
||||
@ -66,6 +63,37 @@ namespace asg_form
|
||||
}
|
||||
|
||||
|
||||
[Command]
|
||||
public string 查询黑名单()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (TestDbContext ctx = new TestDbContext())
|
||||
{
|
||||
var blacks= ctx.T_blacks.ToList();
|
||||
string msg = "为了良好的赛事环境,我们对以下选手进行禁赛处理";
|
||||
foreach (var b in blacks)
|
||||
{
|
||||
msg = $"{msg}\r\n{b.record_name} {b.violator} {b.platform_record} {b.offending_details} {b.processing_result} {b.feature_id}";
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "出现错误";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[Command]
|
||||
public string 近期赛程()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user