add loop command
All checks were successful
tests / fmt (push) Successful in 57s
tests / clippy (push) Successful in 1m16s
tests / pre-commit (push) Successful in 1m14s
tests / build (push) Successful in 1m30s
tests / test (push) Successful in 1m36s

This commit is contained in:
2024-06-17 14:56:39 +02:00
parent 55fe212424
commit 54c36688b7
10 changed files with 223 additions and 18 deletions

View File

@@ -1,5 +1,5 @@
use crate::commands::queue::{build_action_row, build_queue_embeds, TRACKS_PER_PAGE};
use crate::commands::{delete, join, leave, pause, play, queue, resume, skip, stop};
use crate::commands::{delete, join, leave, loop_queue, pause, play, queue, resume, skip, stop};
use crate::state::State;
use futures::Future;
use std::error::Error;
@@ -20,6 +20,7 @@ enum InteractionCommand {
Stop,
Pause,
Skip,
Loop,
Resume,
Leave,
Join,
@@ -112,6 +113,9 @@ impl Handler {
InteractionCommand::Skip => {
spawn(skip(interaction, Arc::clone(&self.state)))
}
InteractionCommand::Loop => {
spawn(loop_queue(interaction, Arc::clone(&self.state)))
}
InteractionCommand::Resume => {
spawn(resume(interaction, Arc::clone(&self.state)))
}
@@ -196,6 +200,7 @@ fn parse_interaction_command(command: &CommandData) -> InteractionCommand {
"stop" => InteractionCommand::Stop,
"pause" => InteractionCommand::Pause,
"skip" => InteractionCommand::Skip,
"loop" => InteractionCommand::Loop,
"resume" => InteractionCommand::Resume,
"leave" => InteractionCommand::Leave,
"join" => InteractionCommand::Join,