/// <summary> /// 收到信息的函数 /// 并匹配相应指令 /// </summary> public async void GetChat(RegexCommand cmdType) { if (PCREventArgs == null || Sender == null) { return; } switch (cmdType) { //查询公会排名 case RegexCommand.GetGuildRank: //以群名为查询名 if (PCREventArgs.Message.RawText.Length <= 6) { var groupInfo = await QQGroup.GetGroupInfo(); if (groupInfo.apiStatus != APIStatusType.OK) { await QQGroup.SendGroupMessage("调用onebot API时发生错误"); Log.Error("api error", $"调用onebot API时发生错误 Status={groupInfo.apiStatus}"); return; } await KyoukaRank(DBHelper.GetGuildName(PCREventArgs.SourceGroup)); } else //手动指定 { await KyoukaRank(PCREventArgs.Message.RawText.Substring(6)); } break; } }
private async void GetGuildRank(string[] commandArgs) { //检查参数 switch (Utils.CheckForLength(commandArgs, 1)) { case LenType.Illegal: await BiliWikiRank(QQGroup.GetGroupInfo().Name); break; case LenType.Legitimate: await BiliWikiRank(commandArgs[1]); break; default: case LenType.Extra: QQGroup.SendGroupMessage("有多余参数"); return; } }