예제 #1
0
        public async Task CopyQueue(CommandContext ctx, [RemainingText] string name)
        {
            var q = await Database.GetQueue(ctx.Guild);

            if (q.Count == 0)
            {
                await ctx.RespondAsync("Nothing in queue");

                return;
            }
            var pls = await PlaylistDB.GetPlaylistsSimple(ctx.Member.Id);

            if (pls.Any(x => x == name))
            {
                await ctx.RespondAsync(embed : new DiscordEmbedBuilder().WithTitle("Copy Queue").WithDescription("**Error** You already have a playlist with that name!").Build());

                return;
            }
            await PlaylistDB.AddPlaylist(name, ctx.Member.Id);

            foreach (var e in q)
            {
                await PlaylistDB.AddEntry(name, ctx.Member.Id, e.track.TrackString);
            }
            await ctx.RespondAsync(embed : new DiscordEmbedBuilder().WithTitle("Queue Copy").WithDescription("Queue was saved to new playlist -> " + name).Build());
        }
예제 #2
0
        public async Task CreateFixed(CommandContext ctx, [RemainingText] string name)
        {
            var inter = ctx.Client.GetInteractivity();
            var pls   = await PlaylistDB.GetPlaylistsSimple(ctx.Member.Id);

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

                return;
            }
            var msg = await ctx.RespondAsync(embed : new DiscordEmbedBuilder().WithTitle("Create Fixed Playlist").WithDescription("Please send the playlist URL now!\n" +
                                                                                                                                  "> Just the link, no bot prefix needed!").Build());

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

            await msg.DeleteAsync();

            LavalinkLoadResult s = null;

            try
            {
                s = await Bot.LLEU[ctx.Client.ShardId].GetTracksAsync(new Uri(gets.Result.Content));
            }
            catch
            {
                await ctx.RespondAsync(embed : new DiscordEmbedBuilder().WithTitle("Create Fixed Playlist").WithDescription("**Error** Reasons could be:\n" +
                                                                                                                            "> The provided link was not a playlist\n" +
                                                                                                                            "> The playlist is unavailable (for example set to private)").Build());

                return;
            }
            if (s.LoadResultType != DSharpPlus.Lavalink.LavalinkLoadResultType.PlaylistLoaded)
            {
                await ctx.RespondAsync(embed : new DiscordEmbedBuilder().WithTitle("Create Fixed Playlist").WithDescription("**Error** Reasons could be:\n" +
                                                                                                                            "> The provided link was not a playlist\n" +
                                                                                                                            "> The playlist is unavailable (for example set to private)").Build());

                return;
            }
            if (gets.Result.Content.Contains("youtu") && !gets.Result.Content.Contains("soundcloud"))
            {
                await PlaylistDB.AddPlaylist(name, ctx.Member.Id, ExtService.Youtube, gets.Result.Content);
            }
            else
            {
                await PlaylistDB.AddPlaylist(name, ctx.Member.Id, ExtService.Soundcloud, gets.Result.Content);
            }
            await ctx.RespondAsync(embed : new DiscordEmbedBuilder().WithTitle("Create Fixed Playlist").WithDescription($"Fixed playlist created with name -> {name} and {s.Tracks.Count()} Songs!").Build());
        }
예제 #3
0
        public async Task Create(CommandContext ctx, [RemainingText] string name)
        {
            var pls = await PlaylistDB.GetPlaylistsSimple(ctx.Member.Id);

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

                return;
            }
            await PlaylistDB.AddPlaylist(name, ctx.Member.Id);

            await ctx.RespondAsync(embed : new DiscordEmbedBuilder().WithTitle("Create Playlist").WithDescription("New Playlist was created -> " + name).Build());
        }