示例#1
0
        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);
        }
示例#2
0
 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
     });
 }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#5
0
        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);
        }
示例#6
0
        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);
        }