wip
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user