private static string ParseResponse(TulingResponseData response) { var result = string.Empty; var builder = new StringBuilder(); builder.Append(result); foreach (var res in response.Results) { switch (res.ResultType) { case "text": builder.Append(res.Values.Text); break; case "image": builder.Append(CodeApi.Code_Image(res.Values.Image)); break; case "voice": builder.Append(CodeApi.Code_Voice(res.Values.Voice)); break; case "url": builder.Append($" {res.Values.Url} "); break; } } result = builder.ToString(); return(result); }
private static void SendAlertMsg(KanColeGirlVoice randGirl, long groupNum, string BindAi) { MsgSender.PushMsg(new MsgCommand { Command = CommandType.SendGroup, Msg = CodeApi.Code_Voice(randGirl.VoiceUrl), ToGroup = groupNum, BindAi = BindAi }); MsgSender.PushMsg(new MsgCommand { Command = CommandType.SendGroup, Msg = randGirl.Content, ToGroup = groupNum, BindAi = BindAi }); }
private bool RandVoice(MsgInformationEx MsgDTO, string name) { var folderPath = "./voices/" + name; var folder = new DirectoryInfo(folderPath); var files = folder.GetFiles(); var file = files.RandElement(); MsgSender.PushMsg(MsgDTO, CodeApi.Code_Voice(file.FullName)); return(true); }
public bool KancoleVoice(MsgInformationEx MsgDTO, object[] param) { var girlName = param[0] as string; var voice = GetRandVoiceInfo(girlName); if (voice == null) { return(false); } MsgSender.PushMsg(MsgDTO, CodeApi.Code_Voice(voice.VoiceUrl)); MsgSender.PushMsg(MsgDTO, voice.Content); return(true); }
private static void SendMultiMediaHello(MsgInformationEx MsgDTO, MultiMediaHelloRecord hello) { var path = hello.Location switch { ResourceLocationType.LocalAbsolute => hello.ContentPath, ResourceLocationType.LocalRelative => new FileInfo(hello.ContentPath).FullName, ResourceLocationType.Network => hello.ContentPath, _ => "" }; var msg = hello.MediaType switch { MultiMediaResourceType.Image => CodeApi.Code_Image(path), MultiMediaResourceType.Voice => CodeApi.Code_Voice(path), _ => "" }; MsgSender.PushMsg(MsgDTO, msg); }
public bool Beng3Voice(MsgInformationEx MsgDTO, object[] param) { var girlName = param[0] as string; var voiceSet = Beng3Config.Config.FirstOrDefault(p => p.Names.Contains(girlName)); if (voiceSet == null) { MsgSender.PushMsg(MsgDTO, "未找到相关信息!", true); return(false); } var folderPath = Beng3Config.VoicePath + voiceSet.Path; var folder = new DirectoryInfo(folderPath); var files = folder.GetFiles(); var file = files.RandElement(); MsgSender.PushMsg(MsgDTO, CodeApi.Code_Voice(file.FullName)); return(true); }