예제 #1
0
        public async Task Rename(CommandContext ctx, [RemainingText] string name = null)
        {
            if (name == null)
            {
                name = await SelectPL(ctx);

                if (name == null)
                {
                    return;
                }
            }
            var inter = ctx.Client.GetInteractivity();
            var p     = await PlaylistDB.GetPlaylistsSimple(ctx.Member.Id);

            if (!p.Any(x => x == name))
            {
                await ctx.RespondAsync(embed : new DiscordEmbedBuilder().WithTitle("Rename Playlist").WithDescription("**Error** You dont have a playlist with that name!").Build());

                return;
            }
            var pls = await PlaylistDB.GetPlaylist(ctx.Member.Id, name);

            await pls.GetEntries();

            var msg = await ctx.RespondAsync(embed : new DiscordEmbedBuilder().WithTitle("Rename Playlist").WithDescription($"Please enter the new playlistname now!\n" +
                                                                                                                            $"No prefix needed!").Build());

            var hm = await inter.WaitForMessageAsync(x => x.Author == ctx.Member, TimeSpan.FromSeconds(30));

            await msg.DeleteAsync();

            await PlaylistDB.RenameList(name, ctx.Member.Id, hm.Result.Content);

            await ctx.RespondAsync(embed : new DiscordEmbedBuilder().WithTitle("Rename Playlist").WithDescription($"Renamed Playlist to\n" +
                                                                                                                  $"{name} -> {hm.Result.Content}!").Build());
        }