This commit is contained in:
2026-02-28 19:30:13 +01:00
parent 30789aa2a9
commit cb272b9cd9
13 changed files with 54 additions and 38 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
[workspace]
resolver = "3"
members = ["types", "master", "worker"]
members = ["master", "types", "worker"]
+12
View File
@@ -1,9 +1,21 @@
FROM rust:1.93.1-alpine3.23 AS builder
RUN --mount=type=cache,target=/root/.cargo \
rustup component add clippy && \
rustup component add rustfmt --toolchain nightly
RUN \
cargo install cargo-sort
WORKDIR /build
COPY . .
RUN --mount=type=cache,target=/build/target \
cargo sort ./**/Cargo.toml --check && \
cargo clippy && \
cargo +nightly fmt --check
RUN --mount=type=cache,target=/build/target \
mkdir release && \
cargo build --workspace --release && \
+2 -2
View File
@@ -4,8 +4,8 @@ version = "0.1.0"
edition = "2024"
[dependencies]
types = { path = "../types" }
async-nats = { version = "0.46.0" }
postcard = { version = "1.1.3", features = ["use-std"] }
serenity = { version = "0.12.5", default-features = false, features = [
"client",
"gateway",
@@ -14,5 +14,5 @@ serenity = { version = "0.12.5", default-features = false, features = [
"collector",
] }
tokio = { version = "1.49.0", features = ["macros", "rt-multi-thread"] }
postcard = { version = "1.1.3", features = ["use-std"] }
types = { path = "../types" }
uuid = { version = "1.21.0" }
+1 -4
View File
@@ -1,7 +1,4 @@
use serenity::builder::*;
use serenity::model::prelude::*;
use serenity::prelude::*;
use serenity::utils::CreateQuickModal;
use serenity::{builder::*, model::prelude::*, prelude::*, utils::CreateQuickModal};
pub async fn run(ctx: &Context, interaction: &CommandInteraction) -> Result<(), serenity::Error> {
let modal = CreateQuickModal::new("About you")
+1 -2
View File
@@ -1,5 +1,4 @@
use serenity::builder::CreateCommand;
use serenity::model::application::ResolvedOption;
use serenity::{builder::CreateCommand, model::application::ResolvedOption};
pub fn run(_options: &[ResolvedOption]) -> String {
"Hey, I'm alive!".to_string()
+15 -10
View File
@@ -1,14 +1,19 @@
use serenity::all::{
CommandInteraction, Context, CreateCommandOption, CreateInteractionResponse,
CreateInteractionResponseMessage,
};
use serenity::builder::CreateCommand;
use serenity::model::application::{CommandOptionType, ResolvedOption, ResolvedValue};
use postcard::to_stdvec;
use types::jobs::{InnerStruct, Job, JobKind};
use types::misc::new_uuid_v4;
use serenity::{
all::{
CommandInteraction,
Context,
CreateCommandOption,
CreateInteractionResponse,
CreateInteractionResponseMessage,
},
builder::CreateCommand,
model::application::{CommandOptionType, ResolvedOption, ResolvedValue},
};
use types::{
jobs::{InnerStruct, Job, JobKind},
misc::new_uuid_v4,
};
pub async fn run(
ctx: &Context,
+10 -5
View File
@@ -2,11 +2,16 @@ mod commands;
use std::env;
use serenity::async_trait;
use serenity::builder::{CreateInteractionResponse, CreateInteractionResponseMessage};
use serenity::model::application::{Command, Interaction};
use serenity::model::gateway::Ready;
use serenity::prelude::*;
use serenity::{
Client,
all::{Context, EventHandler, GatewayIntents},
async_trait,
builder::{CreateInteractionResponse, CreateInteractionResponseMessage},
model::{
application::{Command, Interaction},
gateway::Ready,
},
};
struct Handler {
nats_client: async_nats::Client,
+4
View File
@@ -0,0 +1,4 @@
imports_granularity = "Crate"
imports_layout = "HorizontalVertical"
group_imports = "StdExternalCrate"
reorder_imports = true
+1 -1
View File
@@ -5,4 +5,4 @@ edition = "2024"
[dependencies]
serde = { version = "1.0.228" }
uuid = { version = "1.21.0", features = ["serde", "v4"]}
uuid = { version = "1.21.0", features = ["serde", "v4"] }
+1 -1
View File
@@ -1,5 +1,5 @@
use uuid::Uuid;
pub fn new_uuid_v4() -> Uuid{
pub fn new_uuid_v4() -> Uuid {
Uuid::new_v4()
}
+3 -3
View File
@@ -4,11 +4,11 @@ version = "0.1.0"
edition = "2024"
[dependencies]
types = { path = "../types" }
async-nats = { version = "0.46.0" }
futures = { version = "0.3.32" }
futures-executor = { version = "0.3.32" }
tokio = { version = "1.49.0", features = ["macros", "rt-multi-thread"] }
postcard = { version = "1.1.3", features = ["use-std"] }
yt-dlp = { version = "2.1.0" }
tokio = { version = "1.49.0", features = ["macros", "rt-multi-thread"] }
types = { path = "../types" }
which = { version = "8.0.0" }
yt-dlp = { version = "2.1.0" }
+2 -8
View File
@@ -1,12 +1,9 @@
use core::ops::Deref;
use std::path::PathBuf;
use which::which;
use futures::StreamExt;
use postcard::from_bytes;
use types::jobs::Job;
use which::which;
use yt_dlp::{Downloader, client::Libraries};
#[tokio::main]
@@ -19,10 +16,7 @@ async fn main() {
.await
.unwrap();
let libraries = Libraries::new(
PathBuf::from(which("yt-dlp").unwrap()),
PathBuf::from(which("ffmpeg").unwrap()),
);
let libraries = Libraries::new(which("yt-dlp").unwrap(), which("ffmpeg").unwrap());
let downloader = Downloader::builder(libraries, "output")
.build()
.await