コード例 #1
0
ファイル: MusicModule.cs プロジェクト: HartoSha/5HeadBot
        public async Task Skip()
        {
            var voiceChannel = (Context.User as IVoiceState)?.VoiceChannel;
            var skippedTrack = await _musicService.SkipAsync(voiceChannel);

            if (skippedTrack is null)
            {
                await ReplyAsync(
                    new BotMessageBuilder()
                    .WithEmbedWithTitle("Can't skip - no more tracks left.")
                    .WithDisplayType(BotMessageStyle.Info)
                    );

                return;
            }

            await ReplyAsync(
                skippedTrack
                .AsBotMessageBuilder()
                .WithText("Skipped:")
                .WithEmbedDescription(skippedTrack.AsTimelineString())
                .WithDisplayType(BotMessageStyle.Success)
                );

            var nowPlaying = await _musicService.GetCurrentAsync(voiceChannel);

            if (nowPlaying != null)
            {
                await ReplyAsync(
                    nowPlaying
                    .AsBotMessageBuilder()
                    .WithText("Now playing:")
                    .WithDisplayType(BotMessageStyle.Success)
                    );
            }
        }