public static async Task ShuffleAsync( this LavaPlayer player, AudioHelper audioHelper, EmbedHelper embedHelper, IMessageChannel channel = null, SocketCommandContext context = null) { if (player.Queue.Count < 2) { return; } player.Queue.Shuffle(); if (context != null && !context.Guild.TextChannels.Where(x => x.Id == Program.BotConfig.ChannelId).Any()) { return; } channel ??= context?.Channel; string newQueue = await AudioHelper.GetNewEmbedQueueString(player); await Program.BotConfig.BotEmbedMessage.ModifyAsync(x => x.Content = string.Format(AudioHelper.QueueMayHaveSongs, newQueue)); if (channel != null) { var msg = await embedHelper.BuildMessageEmbed("Queue shuffled"); await channel.SendAndRemove(embed : msg); } }
public static async Task LoopAsync(this LavaPlayer player, AudioHelper audioHelper, EmbedHelper embedHelper, IMessageChannel channel) { audioHelper.RepeatFlag = !audioHelper.RepeatFlag; audioHelper.RepeatTrack = audioHelper.RepeatFlag switch { true => player.Track, false => null }; var embed = await embedHelper.BuildMessageEmbed($"Loop set to `{(audioHelper.RepeatFlag ? "enabled" : "disabled")}`"); await channel.SendAndRemove(embed : embed, timeout : 5000); }