Esempio n. 1
0
        public async Task SoundCloudPl([Leftover] string playlist)
        {
            if (string.IsNullOrWhiteSpace(playlist))
            {
                return;
            }

            var succ = await QueuePreconditionInternalAsync();

            if (!succ)
            {
                return;
            }

            var mp = await _service.GetOrCreateMusicPlayerAsync((ITextChannel)Context.Channel);

            if (mp is null)
            {
                await ReplyErrorLocalizedAsync("no_player");

                return;
            }

            _ = ctx.Channel.TriggerTypingAsync();

            await _service.EnqueueSoundcloudPlaylistAsync(mp, playlist, ctx.User.ToString());

            await ctx.OkAsync();
        }
Esempio n. 2
0
        public async Task LocalPlaylist([Leftover] string dirPath)
        {
            if (string.IsNullOrWhiteSpace(dirPath))
            {
                return;
            }

            var user           = (IGuildUser)Context.User;
            var voiceChannelId = user.VoiceChannel?.Id;

            if (voiceChannelId is null)
            {
                await ReplyErrorLocalizedAsync("must_be_in_voice");

                return;
            }

            _ = ctx.Channel.TriggerTypingAsync();

            var botUser = await ctx.Guild.GetCurrentUserAsync();

            await EnsureBotInVoiceChannelAsync(voiceChannelId !.Value, botUser);

            if (botUser.VoiceChannel?.Id != voiceChannelId)
            {
                await ReplyErrorLocalizedAsync("not_with_bot_in_voice");

                return;
            }

            var mp = await _service.GetOrCreateMusicPlayerAsync((ITextChannel)Context.Channel);

            if (mp is null)
            {
                await ReplyErrorLocalizedAsync("no_player");

                return;
            }

            await _service.EnqueueDirectoryAsync(mp, dirPath, ctx.User.ToString());

            await ReplyConfirmLocalizedAsync("dir_queue_complete").ConfigureAwait(false);
        }
Esempio n. 3
0
        public async Task Playlist([Leftover] string playlistQuery)
        {
            if (string.IsNullOrWhiteSpace(playlistQuery))
            {
                return;
            }

            var succ = await QueuePreconditionInternalAsync();

            if (!succ)
            {
                return;
            }

            var mp = await _service.GetOrCreateMusicPlayerAsync((ITextChannel)Context.Channel);

            if (mp is null)
            {
                await ReplyErrorLocalizedAsync("no_player");

                return;
            }

            _ = Context.Channel.TriggerTypingAsync();


            var queuedCount = await _service.EnqueueYoutubePlaylistAsync(mp, playlistQuery, ctx.User.ToString());

            if (queuedCount == 0)
            {
                await ReplyErrorLocalizedAsync("no_search_results").ConfigureAwait(false);

                return;
            }
            await ctx.OkAsync();
        }