linter
This commit is contained in:
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
[workspace]
|
[workspace]
|
||||||
resolver = "3"
|
resolver = "3"
|
||||||
members = ["types", "master", "worker"]
|
members = ["master", "types", "worker"]
|
||||||
|
|||||||
+12
@@ -1,9 +1,21 @@
|
|||||||
FROM rust:1.93.1-alpine3.23 AS builder
|
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
|
WORKDIR /build
|
||||||
|
|
||||||
COPY . .
|
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 \
|
RUN --mount=type=cache,target=/build/target \
|
||||||
mkdir release && \
|
mkdir release && \
|
||||||
cargo build --workspace --release && \
|
cargo build --workspace --release && \
|
||||||
|
|||||||
+2
-2
@@ -4,8 +4,8 @@ version = "0.1.0"
|
|||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
types = { path = "../types" }
|
|
||||||
async-nats = { version = "0.46.0" }
|
async-nats = { version = "0.46.0" }
|
||||||
|
postcard = { version = "1.1.3", features = ["use-std"] }
|
||||||
serenity = { version = "0.12.5", default-features = false, features = [
|
serenity = { version = "0.12.5", default-features = false, features = [
|
||||||
"client",
|
"client",
|
||||||
"gateway",
|
"gateway",
|
||||||
@@ -14,5 +14,5 @@ serenity = { version = "0.12.5", default-features = false, features = [
|
|||||||
"collector",
|
"collector",
|
||||||
] }
|
] }
|
||||||
tokio = { version = "1.49.0", features = ["macros", "rt-multi-thread"] }
|
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" }
|
uuid = { version = "1.21.0" }
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
use serenity::builder::*;
|
use serenity::{builder::*, model::prelude::*, prelude::*, utils::CreateQuickModal};
|
||||||
use serenity::model::prelude::*;
|
|
||||||
use serenity::prelude::*;
|
|
||||||
use serenity::utils::CreateQuickModal;
|
|
||||||
|
|
||||||
pub async fn run(ctx: &Context, interaction: &CommandInteraction) -> Result<(), serenity::Error> {
|
pub async fn run(ctx: &Context, interaction: &CommandInteraction) -> Result<(), serenity::Error> {
|
||||||
let modal = CreateQuickModal::new("About you")
|
let modal = CreateQuickModal::new("About you")
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
use serenity::builder::CreateCommand;
|
use serenity::{builder::CreateCommand, model::application::ResolvedOption};
|
||||||
use serenity::model::application::ResolvedOption;
|
|
||||||
|
|
||||||
pub fn run(_options: &[ResolvedOption]) -> String {
|
pub fn run(_options: &[ResolvedOption]) -> String {
|
||||||
"Hey, I'm alive!".to_string()
|
"Hey, I'm alive!".to_string()
|
||||||
|
|||||||
@@ -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 postcard::to_stdvec;
|
||||||
|
use serenity::{
|
||||||
use types::jobs::{InnerStruct, Job, JobKind};
|
all::{
|
||||||
use types::misc::new_uuid_v4;
|
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(
|
pub async fn run(
|
||||||
ctx: &Context,
|
ctx: &Context,
|
||||||
|
|||||||
+10
-5
@@ -2,11 +2,16 @@ mod commands;
|
|||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
use serenity::async_trait;
|
use serenity::{
|
||||||
use serenity::builder::{CreateInteractionResponse, CreateInteractionResponseMessage};
|
Client,
|
||||||
use serenity::model::application::{Command, Interaction};
|
all::{Context, EventHandler, GatewayIntents},
|
||||||
use serenity::model::gateway::Ready;
|
async_trait,
|
||||||
use serenity::prelude::*;
|
builder::{CreateInteractionResponse, CreateInteractionResponseMessage},
|
||||||
|
model::{
|
||||||
|
application::{Command, Interaction},
|
||||||
|
gateway::Ready,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
struct Handler {
|
struct Handler {
|
||||||
nats_client: async_nats::Client,
|
nats_client: async_nats::Client,
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
imports_granularity = "Crate"
|
||||||
|
imports_layout = "HorizontalVertical"
|
||||||
|
group_imports = "StdExternalCrate"
|
||||||
|
reorder_imports = true
|
||||||
+1
-1
@@ -5,4 +5,4 @@ edition = "2024"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
serde = { version = "1.0.228" }
|
serde = { version = "1.0.228" }
|
||||||
uuid = { version = "1.21.0", features = ["serde", "v4"]}
|
uuid = { version = "1.21.0", features = ["serde", "v4"] }
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
pub fn new_uuid_v4() -> Uuid{
|
pub fn new_uuid_v4() -> Uuid {
|
||||||
Uuid::new_v4()
|
Uuid::new_v4()
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -4,11 +4,11 @@ version = "0.1.0"
|
|||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
types = { path = "../types" }
|
|
||||||
async-nats = { version = "0.46.0" }
|
async-nats = { version = "0.46.0" }
|
||||||
futures = { version = "0.3.32" }
|
futures = { version = "0.3.32" }
|
||||||
futures-executor = { 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"] }
|
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" }
|
which = { version = "8.0.0" }
|
||||||
|
yt-dlp = { version = "2.1.0" }
|
||||||
|
|||||||
+2
-8
@@ -1,12 +1,9 @@
|
|||||||
use core::ops::Deref;
|
use core::ops::Deref;
|
||||||
use std::path::PathBuf;
|
|
||||||
use which::which;
|
|
||||||
|
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
|
|
||||||
use postcard::from_bytes;
|
use postcard::from_bytes;
|
||||||
|
|
||||||
use types::jobs::Job;
|
use types::jobs::Job;
|
||||||
|
use which::which;
|
||||||
use yt_dlp::{Downloader, client::Libraries};
|
use yt_dlp::{Downloader, client::Libraries};
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
@@ -19,10 +16,7 @@ async fn main() {
|
|||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let libraries = Libraries::new(
|
let libraries = Libraries::new(which("yt-dlp").unwrap(), which("ffmpeg").unwrap());
|
||||||
PathBuf::from(which("yt-dlp").unwrap()),
|
|
||||||
PathBuf::from(which("ffmpeg").unwrap()),
|
|
||||||
);
|
|
||||||
let downloader = Downloader::builder(libraries, "output")
|
let downloader = Downloader::builder(libraries, "output")
|
||||||
.build()
|
.build()
|
||||||
.await
|
.await
|
||||||
|
|||||||
Reference in New Issue
Block a user