Merged projects with plugins and modules

This commit is contained in:
2024-07-22 01:18:00 +03:00
parent 1fd065f4c2
commit 8ace51c840
59 changed files with 1669 additions and 73 deletions

View File

@@ -0,0 +1,54 @@
using Discord;
using Discord.WebSocket;
using DiscordBotCore.Interfaces;
namespace MusicPlayer.SlashCommands;
public class Loop: DBSlashCommand
{
public string Name => "loop";
public string Description => "Loop the current song for a certain amount of times. If no times are specified, it will loop once";
public bool canUseDM => false;
public bool HasInteraction => false;
public List<SlashCommandOptionBuilder> Options => new()
{
new()
{
Type = ApplicationCommandOptionType.Integer,
Name = "times",
Description = "How many times to loop the song",
IsRequired = false
}
};
public void ExecuteServer(SocketSlashCommand context)
{
if (Variables._MusicPlayer.CurrentlyPlaying == null)
{
context.RespondAsync("There is nothing playing right now");
return;
}
var times = context.Data.Options.FirstOrDefault()?.Value.ToString() ?? "1";
if (!int.TryParse(times, out var timesToLoop))
{
context.RespondAsync("Invalid number");
return;
}
if (timesToLoop < 1)
{
context.RespondAsync("You need to specify a number greater than 0");
return;
}
Variables._MusicPlayer.Loop(timesToLoop);
context.RespondAsync($"Looping {Variables._MusicPlayer.CurrentlyPlaying.Title} {timesToLoop} times. Check the queue to see the progress");
}
}