Skip to content

Commit

Permalink
添加管理员查询个人出刀记录的功能
Browse files Browse the repository at this point in the history
优化响应
  • Loading branch information
Yukari316 committed Sep 23, 2020
1 parent 85c0bd8 commit a4421ca
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 15 deletions.
8 changes: 4 additions & 4 deletions SuiseiBot.Export/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("SuiseiBot.Export")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2020")]
[assembly: AssemblyProduct("SuiseiBot")]
[assembly: AssemblyCopyright("Copyright © SuiseiKawaii 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -32,5 +32,5 @@
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.1.0")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyVersion("0.2.2.0923")]
[assembly: AssemblyFileVersion("0.2.2.0923")]
52 changes: 43 additions & 9 deletions SuiseiBot/PCRGuildManager/GuildBattleManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public void GuildBattleResponse() //指令分发

//显示出刀表
case PCRGuildCmdType.ShowAttackList:
if(!ZeroArgsCheck() || !MemberCheck() || !InBattleCheck()) return;
if(!MemberCheck() || !InBattleCheck()) return;
ShowAttackList();
break;

Expand Down Expand Up @@ -831,6 +831,7 @@ private void SL(bool cleanSL = false)
{
//仅能管理员执行 需要额外参数
//判断今天是否使用过SL

#region 参数检查
long memberUid;

Expand Down Expand Up @@ -860,6 +861,7 @@ private void SL(bool cleanSL = false)
return;
}
#endregion

if (member.SL >= Utils.GetUpdateStamp())
{
if (!GuildBattleDB.SetMemberSL(memberUid, true))
Expand Down Expand Up @@ -922,15 +924,16 @@ private void LeaveTree()
{
#region 参数检查
long memberUid;
switch (Utils.CheckForLength(CommandArgs,0))
switch (Utils.CheckForLength(CommandArgs,1))
{
case LenType.Legitimate: //正常
memberUid = SenderQQ.Id;
break;
case LenType.Extra: //管理员撤销
memberUid = GetUidInMsg();
if (memberUid == -1) return;
break;
case LenType.Extra:
QQGroup.SendGroupMessage(CQApi.CQCode_At(SenderQQ.Id),
"有多余参数");
return;
default:
QQGroup.SendGroupMessage(CQApi.CQCode_At(SenderQQ.Id),
"发生未知错误,请联系机器人管理员");
Expand Down Expand Up @@ -1204,7 +1207,37 @@ private void ShowAllAttackList()
/// </summary>
private void ShowAttackList()
{
List<GuildBattle> todayAttacksList = GuildBattleDB.GetTodayAttacks(SenderQQ.Id);
#region 参数检查
long memberUid;
switch (Utils.CheckForLength(CommandArgs,0))
{
case LenType.Legitimate: //正常
memberUid = SenderQQ.Id;
break;
case LenType.Extra: //管理员查询
if(!IsAdmin()) return;//检查权限
memberUid = GetUidInMsg();
if (memberUid == -1) return;
break;
default:
QQGroup.SendGroupMessage(CQApi.CQCode_At(SenderQQ.Id),
"发生未知错误,请联系机器人管理员");
ConsoleLog.Error("Unknown error","LenType");
return;
}

ConsoleLog.Debug("get Uid", memberUid);

//查找成员信息
MemberInfo member = GuildBattleDB.GetMemberInfo(memberUid);
if (member == null)
{
DBMsgUtils.DatabaseFailedTips(GBEventArgs);
return;
}
#endregion

List<GuildBattle> todayAttacksList = GuildBattleDB.GetTodayAttacks(memberUid);
//首先检查是否记录为空
if (todayAttacksList == null)
{
Expand All @@ -1213,8 +1246,9 @@ private void ShowAttackList()
}
if (todayAttacksList.Count == 0)
{
QQGroup.SendGroupMessage(CQApi.CQCode_At(SenderQQ.Id),
"你今天还没出刀呢!");
QQGroup.SendGroupMessage(IsAdmin() ? "成员" : "",
CQApi.CQCode_At(SenderQQ.Id),
IsAdmin() ? "今天还没出刀呢!" : "你今天还没出刀呢!");
return;
}
//构造群消息文本
Expand Down Expand Up @@ -1476,7 +1510,7 @@ private long GetUidInMsg()
const string ROUND_CODE = "ABCDEFGHIJKLNMOPQRSTUVWXYZ";
private string GetBossCode(int round, int order)
{
return $"{ROUND_CODE[round - 1]}{order}";
return round > 26 ? $"{round} - {order}" : $"{ROUND_CODE[round - 1]}{order}";
}
#endregion
}
Expand Down
4 changes: 2 additions & 2 deletions SuiseiBot/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("0.2.2.0923")]
[assembly: AssemblyFileVersion("0.2.2.0923")]

0 comments on commit a4421ca

Please sign in to comment.