This commit is contained in:
2026-03-17 00:18:09 +01:00
parent 1564a4de44
commit a679760b55
6 changed files with 112 additions and 61 deletions
+10 -5
View File
@@ -1,4 +1,4 @@
use nats_libs::functions::JobClient;
use nats_libs::job::JobClient;
use serenity::{
all::{CommandInteraction, Context, CreateCommandOption},
builder::CreateCommand,
@@ -12,10 +12,12 @@ use types::{
};
use url::Url;
use crate::common::Services;
pub async fn run(
services: &Services,
ctx: &Context,
interaction: &CommandInteraction,
nats_client: &async_nats::Client,
) -> Result<(), CorroError> {
let options = interaction.data.options();
@@ -36,7 +38,8 @@ pub async fn run(
let is_url = value.starts_with("https://") || value.starts_with("http://");
if !is_url {
let search_response = match nats_client
let search_response = match services
.nats_client
.send_job(JobsMap::Search(SearchJob {
uuid: new_uuid_v4(),
query: value.to_string(),
@@ -60,7 +63,8 @@ pub async fn run(
url = parse_url_or_default(value.to_string());
}
let download_response = match nats_client
let download_response = match services
.nats_client
.send_job(JobsMap::Download(DownloadJob {
uuid: new_uuid_v4(),
url,
@@ -88,7 +92,8 @@ pub async fn run(
.channel_id
.unwrap();
match nats_client
match services
.nats_client
.send_job(JobsMap::Play(PlayJob {
uuid: new_uuid_v4(),
path: download_response.path,