예제 #1
0
        public async Task Pause(CommandContext ctx)
        {
            if (ctx.Member.VoiceState == null || ctx.Member.VoiceState.Channel == null)
            {
                await ctx.RespondAsync("You are not in a vc.");

                return;
            }
            LavalinkNodeConnection  node = ctx.Client.GetLavalink().ConnectedNodes.Values.First();
            LavalinkGuildConnection conn = node.GetGuildConnection(ctx.Member.VoiceState.Guild);

            if (conn == null)
            {
                await ctx.RespondAsync("Lavalink not connected");

                return;
            }
            if (conn.CurrentState.CurrentTrack == null)
            {
                await ctx.RespondAsync("Nothing playing");

                return;
            }
            await conn.PauseAsync();

            await ctx.RespondAsync("Paused");
        }
예제 #2
0
        public async Task Pause(CommandContext ctx)
        {
            LavalinkNodeConnection lavalinkNodeConnection = await Connections.GetNodeConnection(ctx);

            LavalinkGuildConnection lavalinkGuildConnection = lavalinkNodeConnection.GetGuildConnection(ctx.Guild);
            await lavalinkGuildConnection.PauseAsync();

            Messaging messaging = new Messaging(ctx);
            await messaging.RespondContent()("⏸️ Paused.");
        }
예제 #3
0
        public async Task Pause(CommandContext context)
        {
            if (context.Channel.Id == BotClient.configJson.ComandosBotCanalId)
            {
                guildConnection = BotClient.LavalinkNode.GetGuildConnection(await BotClient.Lavalink.Client.GetGuildAsync(BotClient.configJson.ServerId).ConfigureAwait(false));

                if (BotClient.IsSongPlaying && guildConnection != null)
                {
                    await guildConnection.PauseAsync().ConfigureAwait(false);

                    await context.RespondAsync($"Ok {context.User.Username}! Música pausada!").ConfigureAwait(false);

                    BotClient.IsSongPlaying = false;
                }
                else
                {
                    await context.RespondAsync($"{context.User.Username} a música ja está pausada!").ConfigureAwait(false);
                }
            }
        }