Пример #1
0
        public static async void Play(SoraMessage e, long id)
        {
            var detail = await CloudMusicApi.GetSongDetail(id);

            if (detail == null)
            {
                await e.ReplyToOriginal("曲目信息获取失败");
            }
            else
            {
                var url = await CloudMusicApi.GetSongUrl(id, 128000);

                if (url.Id == detail.Id && url.Id == id)
                {
                    await e.Reply(CQCode.CQImage(detail.Album.GetPicUrl(512, 512)),
                                  new StringBuilder().AppendLine()
                                  .AppendLine("♬ " + detail.Name)
                                  .AppendLine("✎ " + string.Join(" / ", detail.Artists))
                                  .AppendLine(detail.Url)
                                  .Append("√ 曲目链接已解析,正在下载中……")
                                  .ToString());

                    await e.Reply(CQCode.CQRecord(url.Url));
                }
                else
                {
                    await e.Reply(CQCode.CQImage(detail.Album.GetPicUrl(512, 512)),
                                  new StringBuilder().AppendLine()
                                  .AppendLine("♬ " + detail.Name)
                                  .AppendLine("✎ " + string.Join(" / ", detail.Artists))
                                  .AppendLine(detail.Url)
                                  .Append("× 解析曲目链接失败")
                                  .ToString());
                }
            }
        }
        public async Task Play(long id)
        {
            var msg = await ReplyAsync("曲目搜索中……");

            var detail = await CloudMusicApi.GetSongDetail(id);

            if (detail == null)
            {
                await msg.ModifyAsync(x => x.Content = "曲目信息获取失败");
            }
            else
            {
                var url = await CloudMusicApi.GetSongUrl(id);

                if (url.Id == detail.Id && url.Id == id)
                {
                    await msg.ModifyAsync(x => x.Content = new StringBuilder()
                                          .AppendLine(detail.Album.GetPicUrl(512, 512))
                                          .AppendLine("♬ " + detail.Name)
                                          .AppendLine("✎ " + string.Join(" / ", detail.Artists))
                                          .AppendLine(detail.Url)
                                          .Append("√ 曲目链接:" + url.Url)
                                          .ToString());
                }
                else
                {
                    await msg.ModifyAsync(x => x.Content = new StringBuilder()
                                          .AppendLine(detail.Album.GetPicUrl(512, 512))
                                          .AppendLine("♬ " + detail.Name)
                                          .AppendLine("✎ " + string.Join(" / ", detail.Artists))
                                          .AppendLine(detail.Url)
                                          .Append("× 解析曲目链接失败")
                                          .ToString());
                }
            }
        }