mirror of
https://github.com/eRgo35/lyra.git
synced 2026-02-04 12:26:10 +01:00
cleanup part two
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
|||||||
/target
|
/target
|
||||||
.env
|
.env
|
||||||
|
|
||||||
|
|||||||
78
Cargo.lock
generated
78
Cargo.lock
generated
@@ -124,6 +124,21 @@ version = "0.21.7"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"
|
checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bit-set"
|
||||||
|
version = "0.5.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1"
|
||||||
|
dependencies = [
|
||||||
|
"bit-vec",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bit-vec"
|
||||||
|
version = "0.6.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitflags"
|
name = "bitflags"
|
||||||
version = "1.3.2"
|
version = "1.3.2"
|
||||||
@@ -476,6 +491,17 @@ dependencies = [
|
|||||||
"version_check",
|
"version_check",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fancy-regex"
|
||||||
|
version = "0.13.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "531e46835a22af56d1e3b66f04844bed63158bc094a628bec1d321d9b4c44bf2"
|
||||||
|
dependencies = [
|
||||||
|
"bit-set",
|
||||||
|
"regex-automata 0.4.5",
|
||||||
|
"regex-syntax 0.8.2",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fastrand"
|
name = "fastrand"
|
||||||
version = "2.0.1"
|
version = "2.0.1"
|
||||||
@@ -936,6 +962,7 @@ name = "lyra"
|
|||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dotenv",
|
"dotenv",
|
||||||
|
"fancy-regex",
|
||||||
"openssl",
|
"openssl",
|
||||||
"poise",
|
"poise",
|
||||||
"regex",
|
"regex",
|
||||||
@@ -2067,10 +2094,14 @@ checksum = "62e48dba70095f265fdb269b99619b95d04c89e619538138383e63310b14d941"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"symphonia-bundle-flac",
|
"symphonia-bundle-flac",
|
||||||
|
"symphonia-bundle-mp3",
|
||||||
|
"symphonia-codec-aac",
|
||||||
"symphonia-codec-adpcm",
|
"symphonia-codec-adpcm",
|
||||||
|
"symphonia-codec-alac",
|
||||||
"symphonia-codec-pcm",
|
"symphonia-codec-pcm",
|
||||||
"symphonia-codec-vorbis",
|
"symphonia-codec-vorbis",
|
||||||
"symphonia-core",
|
"symphonia-core",
|
||||||
|
"symphonia-format-isomp4",
|
||||||
"symphonia-format-mkv",
|
"symphonia-format-mkv",
|
||||||
"symphonia-format-ogg",
|
"symphonia-format-ogg",
|
||||||
"symphonia-format-wav",
|
"symphonia-format-wav",
|
||||||
@@ -2089,6 +2120,30 @@ dependencies = [
|
|||||||
"symphonia-utils-xiph",
|
"symphonia-utils-xiph",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "symphonia-bundle-mp3"
|
||||||
|
version = "0.5.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0f31d7fece546f1e6973011a9eceae948133bbd18fd3d52f6073b1e38ae6368a"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 1.3.2",
|
||||||
|
"lazy_static",
|
||||||
|
"log",
|
||||||
|
"symphonia-core",
|
||||||
|
"symphonia-metadata",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "symphonia-codec-aac"
|
||||||
|
version = "0.5.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "68bdd75b25ce4b84b12a4bd20bfea2460c2dbd7fc1d227ef5533504d3168109d"
|
||||||
|
dependencies = [
|
||||||
|
"lazy_static",
|
||||||
|
"log",
|
||||||
|
"symphonia-core",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "symphonia-codec-adpcm"
|
name = "symphonia-codec-adpcm"
|
||||||
version = "0.5.3"
|
version = "0.5.3"
|
||||||
@@ -2099,6 +2154,16 @@ dependencies = [
|
|||||||
"symphonia-core",
|
"symphonia-core",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "symphonia-codec-alac"
|
||||||
|
version = "0.5.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3a27e8763d1c9eff666faf903e73a99d4de2f7a93fca4e3c214c1d68432903b9"
|
||||||
|
dependencies = [
|
||||||
|
"log",
|
||||||
|
"symphonia-core",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "symphonia-codec-pcm"
|
name = "symphonia-codec-pcm"
|
||||||
version = "0.5.3"
|
version = "0.5.3"
|
||||||
@@ -2133,6 +2198,19 @@ dependencies = [
|
|||||||
"log",
|
"log",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "symphonia-format-isomp4"
|
||||||
|
version = "0.5.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ffdf14bae5cf352032416bc64151e5d6242d29d33cbf3238513b44d4427a1efb"
|
||||||
|
dependencies = [
|
||||||
|
"encoding_rs",
|
||||||
|
"log",
|
||||||
|
"symphonia-core",
|
||||||
|
"symphonia-metadata",
|
||||||
|
"symphonia-utils-xiph",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "symphonia-format-mkv"
|
name = "symphonia-format-mkv"
|
||||||
version = "0.5.3"
|
version = "0.5.3"
|
||||||
|
|||||||
@@ -13,13 +13,14 @@ keywords = ["discord", "bot", "rust", "music", "featureful"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
dotenv = "0.15.0"
|
dotenv = "0.15.0"
|
||||||
|
fancy-regex = "0.13.0"
|
||||||
openssl = { version = "0.10.63", features = ["vendored"] }
|
openssl = { version = "0.10.63", features = ["vendored"] }
|
||||||
poise = "0.6.1"
|
poise = "0.6.1"
|
||||||
regex = "1.10.3"
|
regex = "1.10.3"
|
||||||
reqwest = "0.11.23"
|
reqwest = "0.11.23"
|
||||||
serenity = { version = "0.12.0", features = ["cache", "framework", "standard_framework", "voice"] }
|
serenity = { version = "0.12.0", features = ["cache", "framework", "standard_framework", "voice"] }
|
||||||
songbird = { version = "0.4.0", features = ["builtin-queue", "serenity"] }
|
songbird = { version = "0.4.0", features = ["builtin-queue", "serenity"] }
|
||||||
symphonia = "0.5.3"
|
symphonia = { version = "0.5.3", features = ["aac", "adpcm", "alac", "flac", "mpa", "isomp4"] }
|
||||||
tokio = { version = "1.35.1", features = ["macros", "full", "signal"] }
|
tokio = { version = "1.35.1", features = ["macros", "full", "signal"] }
|
||||||
tracing = "0.1.40"
|
tracing = "0.1.40"
|
||||||
tracing-futures = "0.2.5"
|
tracing-futures = "0.2.5"
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
pub mod kashi;
|
|
||||||
pub mod music;
|
|
||||||
pub mod tools;
|
|
||||||
70
src/main.rs
70
src/main.rs
@@ -1,36 +1,18 @@
|
|||||||
use songbird::SerenityInit;
|
|
||||||
|
|
||||||
use poise::serenity_prelude::{self as serenity, ActivityData};
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use tracing::{info, warn, error};
|
use tracing::{info, warn, error};
|
||||||
|
use poise::serenity_prelude::{self as serenity, ActivityData};
|
||||||
|
use songbird::SerenityInit;
|
||||||
use reqwest::Client as HttpClient;
|
use reqwest::Client as HttpClient;
|
||||||
|
|
||||||
mod http;
|
|
||||||
mod commands;
|
mod commands;
|
||||||
|
mod http;
|
||||||
|
|
||||||
// http typemap for handling requests
|
use crate::commands::kashi;
|
||||||
|
use crate::commands::music;
|
||||||
|
use crate::commands::tools;
|
||||||
use crate::http::HttpKey;
|
use crate::http::HttpKey;
|
||||||
|
|
||||||
// commands: music
|
|
||||||
use crate::commands::music::deafen::*;
|
|
||||||
use crate::commands::music::join::*;
|
|
||||||
use crate::commands::music::leave::*;
|
|
||||||
use crate::commands::music::mute::*;
|
|
||||||
use crate::commands::music::play::*;
|
|
||||||
use crate::commands::music::queue::*;
|
|
||||||
use crate::commands::music::skip::*;
|
|
||||||
use crate::commands::music::stop::*;
|
|
||||||
use crate::commands::music::repeat::*;
|
|
||||||
use crate::commands::music::pause::*;
|
|
||||||
use crate::commands::music::resume::*;
|
|
||||||
|
|
||||||
// commands: tools
|
|
||||||
use crate::commands::tools::ping::*;
|
|
||||||
|
|
||||||
// commands: kashi
|
|
||||||
use crate::commands::kashi::kashi::*;
|
|
||||||
|
|
||||||
type Error = Box<dyn std::error::Error + Send + Sync>;
|
type Error = Box<dyn std::error::Error + Send + Sync>;
|
||||||
type Context<'a> = poise::Context<'a, Data, Error>;
|
type Context<'a> = poise::Context<'a, Data, Error>;
|
||||||
|
|
||||||
@@ -50,16 +32,8 @@ async fn on_error(error: poise::FrameworkError<'_, Data, Error>) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is for debug only
|
|
||||||
#[poise::command(prefix_command)]
|
|
||||||
pub async fn register(ctx: Context<'_>) -> Result<(), Error> {
|
|
||||||
poise::builtins::register_application_commands_buttons(ctx).await?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
// logger and dotenv initialization
|
|
||||||
tracing_subscriber::fmt::init();
|
tracing_subscriber::fmt::init();
|
||||||
dotenv::dotenv().expect("Failed to load .env file.");
|
dotenv::dotenv().expect("Failed to load .env file.");
|
||||||
|
|
||||||
@@ -67,24 +41,20 @@ async fn main() {
|
|||||||
let prefix = std::env::var("PREFIX").expect("Environment variable `PREFIX` not found!");
|
let prefix = std::env::var("PREFIX").expect("Environment variable `PREFIX` not found!");
|
||||||
|
|
||||||
let commands = vec![
|
let commands = vec![
|
||||||
// commands: music
|
kashi::kashi(),
|
||||||
deafen(),
|
music::deafen(),
|
||||||
join(),
|
music::join(),
|
||||||
leave(),
|
music::leave(),
|
||||||
repeat(),
|
music::repeat(),
|
||||||
mute(),
|
music::mute(),
|
||||||
pause(),
|
music::pause(),
|
||||||
play(),
|
music::play(),
|
||||||
queue(),
|
music::queue(),
|
||||||
resume(),
|
music::resume(),
|
||||||
skip(),
|
music::skip(),
|
||||||
stop(),
|
music::stop(),
|
||||||
// commands: tools
|
tools::ping(),
|
||||||
ping(),
|
tools::register(),
|
||||||
// commands: kashi
|
|
||||||
kashi(),
|
|
||||||
// commands: debug
|
|
||||||
register(),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
let options = poise::FrameworkOptions {
|
let options = poise::FrameworkOptions {
|
||||||
|
|||||||
Reference in New Issue
Block a user