Add /shuffle command
Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
This commit is contained in:
parent
7337bc4024
commit
090d3e426d
2 changed files with 28 additions and 2 deletions
|
@ -165,6 +165,27 @@ public sealed class ControlsCommandGroup(
|
|||
feedbackService.Theme.Success);
|
||||
}
|
||||
|
||||
[Command("shuffle")]
|
||||
[Description("Changes player repeat mode")]
|
||||
[DiscordDefaultDMPermission(false)]
|
||||
[UsedImplicitly]
|
||||
public async Task<Result> ShuffleCommandAsync(
|
||||
[Description("Enable shuffle mode")] bool enable)
|
||||
{
|
||||
var player = await LavalinkPlayer.GetPlayerAsync(
|
||||
commandContext, audioService, feedbackService);
|
||||
if (player is null)
|
||||
{
|
||||
return Result.FromSuccess();
|
||||
}
|
||||
|
||||
player.Shuffle = enable;
|
||||
|
||||
return await feedbackService.SendContextualMessageResult(
|
||||
$"Shuffle mode is now {Markdown.Bold(enable ? "enabled" : "disabled")}",
|
||||
feedbackService.Theme.Success);
|
||||
}
|
||||
|
||||
[Command("seek")]
|
||||
[Description("Rewinds the current track to a specific position")]
|
||||
[DiscordDefaultDMPermission(false)]
|
||||
|
|
|
@ -84,15 +84,20 @@ public sealed class InfoCommandGroup(
|
|||
var repeatMode = player.RepeatMode;
|
||||
if (repeatMode is not TrackRepeatMode.None)
|
||||
{
|
||||
builder.AppendLine($"> The current repeat mode is set to {Markdown.Bold(repeatMode.ToString())}");
|
||||
builder.AppendLine($"> Repeat mode was set to {Markdown.Bold(repeatMode.ToString())}");
|
||||
}
|
||||
|
||||
if (repeatMode is TrackRepeatMode.Track)
|
||||
{
|
||||
builder.AppendLine("Use **/nowplaying** to show current playing track");
|
||||
builder.AppendLine($"Use {Markdown.Bold("/nowplaying")} to show current playing track");
|
||||
return Result.FromSuccess();
|
||||
}
|
||||
|
||||
if (player.Shuffle)
|
||||
{
|
||||
builder.AppendLine($"> Shuffle mode was {Markdown.Bold("enabled")}");
|
||||
}
|
||||
|
||||
for (var i = 0; i < queue.Count; i++)
|
||||
{
|
||||
var track = queue[i].Track;
|
||||
|
|
Loading…
Reference in a new issue