mirror of
https://github.com/eRgo35/lyra.git
synced 2026-02-04 20:36:10 +01:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
8fa86b0182
|
|||
|
d75c5bc9a2
|
|||
|
21822405c0
|
|||
|
3b0121699f
|
|||
|
a27e95a88d
|
2
.env.example
Normal file
2
.env.example
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
DISCORD_TOKEN=<YOUR_DISCORD_TOKEN>
|
||||||
|
PREFIX=<YOUR_PREFIX>
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
|||||||
/target
|
/target
|
||||||
.env
|
.env
|
||||||
|
|
||||||
|
|||||||
81
Cargo.lock
generated
81
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"
|
||||||
@@ -933,9 +959,10 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lyra"
|
name = "lyra"
|
||||||
version = "0.3.0"
|
version = "0.5.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"
|
||||||
@@ -2338,6 +2416,7 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
"mio",
|
"mio",
|
||||||
"num_cpus",
|
"num_cpus",
|
||||||
|
"parking_lot",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
"signal-hook-registry",
|
"signal-hook-registry",
|
||||||
"socket2",
|
"socket2",
|
||||||
|
|||||||
15
Cargo.toml
15
Cargo.toml
@@ -1,18 +1,27 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "lyra"
|
name = "lyra"
|
||||||
version = "0.3.0"
|
version = "0.5.0"
|
||||||
|
authors = ["Michał Czyż <mike@c2yz.com>"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
description = "A featureful Discord bot written in Rust."
|
||||||
|
documentation = "https://lyra.c2yz.com/docs"
|
||||||
|
readme = "README.md"
|
||||||
|
homepage = "https://lyra.c2yz.com"
|
||||||
|
license-file = "LICENSE.md"
|
||||||
|
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", "rt-multi-thread", "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"
|
||||||
tracing-subscriber = "0.3.18"
|
tracing-subscriber = "0.3.18"
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
# License
|
# License
|
||||||
|
|
||||||
Copyright(c) Michał Czyż 2024
|
Copyright (C) 2024 Michał Czyż
|
||||||
|
|
||||||
[Currently] All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
|
This build is private and shall not be distributed nor modified without permission.
|
||||||
|
|||||||
0
scripts/cross-build.sh
Normal file → Executable file
0
scripts/cross-build.sh
Normal file → Executable file
2
scripts/launch.sh
Normal file → Executable file
2
scripts/launch.sh
Normal file → Executable file
@@ -1,3 +1,3 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
nohup ./lyra > lyra.log 2> lyra.err < /dev/null &
|
nohup ../lyra > lyra.log 2> lyra.err < /dev/null &
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
pub mod kashi;
|
pub mod kashi;
|
||||||
pub mod misc;
|
|
||||||
pub mod music;
|
pub mod music;
|
||||||
pub mod tools;
|
pub mod tools;
|
||||||
|
pub mod embeds;
|
||||||
37
src/commands/embeds.rs
Normal file
37
src/commands/embeds.rs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
use crate::{Context, Error};
|
||||||
|
|
||||||
|
use serenity::{builder::{CreateEmbedAuthor, CreateEmbedFooter}, model::{Colour, Timestamp}};
|
||||||
|
use poise::serenity_prelude::CreateEmbed;
|
||||||
|
use poise::CreateReply;
|
||||||
|
|
||||||
|
pub async fn fail(ctx: Context<'_>, err: String) -> Result<(), Error> {
|
||||||
|
ctx.send(
|
||||||
|
CreateReply::default().embed(error_embed(ctx, &format!("Failed: {:?}", err)).await.unwrap())
|
||||||
|
).await?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn error_embed(ctx: Context<'_>, msg: &str) -> Result<CreateEmbed, Error> {
|
||||||
|
let embed = CreateEmbed::default()
|
||||||
|
.author(CreateEmbedAuthor::new("Something went wrong!").icon_url(ctx.author().clone().face()))
|
||||||
|
.colour(Colour::from_rgb(255, 58, 97))
|
||||||
|
.title("Oopsie, Doopsie!")
|
||||||
|
.description(msg)
|
||||||
|
.timestamp(Timestamp::now())
|
||||||
|
.footer(CreateEmbedFooter::new(ctx.cache().current_user().name.to_string()).icon_url(ctx.cache().current_user().face()));
|
||||||
|
|
||||||
|
Ok(embed)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn embed(ctx: Context<'_>, author: &str, description: &str, title: &str) -> Result<CreateEmbed, Error> {
|
||||||
|
let embed = CreateEmbed::default()
|
||||||
|
.author(CreateEmbedAuthor::new(author).icon_url(ctx.author().clone().face()))
|
||||||
|
.colour(Colour::from_rgb(255, 58, 97))
|
||||||
|
.title(title)
|
||||||
|
.description(description)
|
||||||
|
.timestamp(Timestamp::now())
|
||||||
|
.footer(CreateEmbedFooter::new(ctx.cache().current_user().name.to_string()).icon_url(ctx.cache().current_user().face()));
|
||||||
|
|
||||||
|
Ok(embed)
|
||||||
|
}
|
||||||
3
src/commands/kashi.rs
Normal file
3
src/commands/kashi.rs
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
pub mod kashi;
|
||||||
|
|
||||||
|
pub use kashi::kashi;
|
||||||
@@ -1,7 +1,14 @@
|
|||||||
use crate::{Context, Error};
|
use crate::{Context, Error};
|
||||||
|
|
||||||
#[poise::command(prefix_command, slash_command)]
|
/// Kashi integration platform (WIP)
|
||||||
pub async fn kashi(ctx: Context<'_>) -> Result<(), Error> {
|
#[poise::command(
|
||||||
|
prefix_command,
|
||||||
|
slash_command,
|
||||||
|
category = "Kashi"
|
||||||
|
)]
|
||||||
|
pub async fn kashi(
|
||||||
|
ctx: Context<'_>
|
||||||
|
) -> Result<(), Error> {
|
||||||
|
|
||||||
let response = format!("Kashi platform is currently under construction!");
|
let response = format!("Kashi platform is currently under construction!");
|
||||||
ctx.say(response).await?;
|
ctx.say(response).await?;
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
pub mod kashi;
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
use serenity::model::channel::Message;
|
|
||||||
use serenity::Result as SerenityResult;
|
|
||||||
|
|
||||||
pub fn check_msg(result: SerenityResult<Message>) {
|
|
||||||
if let Err(why) = result {
|
|
||||||
println!("Error sending message: {:?}", why);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
24
src/commands/music.rs
Normal file
24
src/commands/music.rs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
pub mod deafen;
|
||||||
|
pub mod join;
|
||||||
|
pub mod leave;
|
||||||
|
pub mod notifier;
|
||||||
|
pub mod mute;
|
||||||
|
pub mod pause;
|
||||||
|
pub mod play;
|
||||||
|
pub mod queue;
|
||||||
|
pub mod repeat;
|
||||||
|
pub mod resume;
|
||||||
|
pub mod skip;
|
||||||
|
pub mod stop;
|
||||||
|
|
||||||
|
pub use deafen::deafen;
|
||||||
|
pub use join::join;
|
||||||
|
pub use leave::leave;
|
||||||
|
pub use mute::mute;
|
||||||
|
pub use pause::pause;
|
||||||
|
pub use play::play;
|
||||||
|
pub use queue::queue;
|
||||||
|
pub use repeat::repeat;
|
||||||
|
pub use resume::resume;
|
||||||
|
pub use skip::skip;
|
||||||
|
pub use stop::stop;
|
||||||
@@ -1,24 +1,31 @@
|
|||||||
use serenity::framework::standard::macros::command;
|
use crate::{commands::embeds::{error_embed, embed, fail}, Context, Error};
|
||||||
use serenity::framework::standard::CommandResult;
|
use poise::CreateReply;
|
||||||
use serenity::model::prelude::*;
|
|
||||||
use serenity::prelude::*;
|
|
||||||
|
|
||||||
use crate::commands::misc::check_msg;
|
/// Deafens itself while in a voice channel; \
|
||||||
|
/// aliases: deafen, undeaden, shuush
|
||||||
|
#[poise::command(
|
||||||
|
prefix_command,
|
||||||
|
slash_command,
|
||||||
|
aliases("shuush", "undeafen"),
|
||||||
|
category = "Music"
|
||||||
|
)]
|
||||||
|
pub async fn deafen(
|
||||||
|
ctx: Context<'_>
|
||||||
|
) -> Result<(), Error> {
|
||||||
|
let guild_id = ctx.guild_id().unwrap();
|
||||||
|
|
||||||
#[command]
|
let manager = songbird::get(&ctx.serenity_context())
|
||||||
#[only_in(guilds)]
|
|
||||||
async fn deafen(ctx: &Context, msg: &Message) -> CommandResult {
|
|
||||||
let guild_id = msg.guild_id.unwrap();
|
|
||||||
|
|
||||||
let manager = songbird::get(ctx)
|
|
||||||
.await
|
.await
|
||||||
.expect("Client placed at init")
|
.expect("Songbird client placed at init")
|
||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
let handler_lock = match manager.get(guild_id) {
|
let handler_lock = match manager.get(guild_id) {
|
||||||
Some(handler) => handler,
|
Some(handler) => handler,
|
||||||
None => {
|
None => {
|
||||||
check_msg(msg.reply(ctx, "Not in a voice channel").await);
|
let msg = "I am not in a voice channel!";
|
||||||
|
ctx.send(
|
||||||
|
CreateReply::default().embed(error_embed(ctx, msg).await.unwrap())
|
||||||
|
).await?;
|
||||||
|
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
@@ -28,24 +35,20 @@ async fn deafen(ctx: &Context, msg: &Message) -> CommandResult {
|
|||||||
|
|
||||||
if handler.is_deaf() {
|
if handler.is_deaf() {
|
||||||
if let Err(err) = handler.deafen(false).await {
|
if let Err(err) = handler.deafen(false).await {
|
||||||
check_msg(
|
fail(ctx, err.to_string()).await.unwrap();
|
||||||
msg.channel_id
|
|
||||||
.say(&ctx.http, format!("Failed: {:?}", err))
|
|
||||||
.await,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
check_msg(msg.channel_id.say(&ctx.http, "Undeafened").await);
|
ctx.send(
|
||||||
|
CreateReply::default().embed(embed(ctx, "Undeafened!", "", "").await.unwrap())
|
||||||
|
).await?;
|
||||||
} else {
|
} else {
|
||||||
if let Err(err) = handler.deafen(true).await {
|
if let Err(err) = handler.deafen(true).await {
|
||||||
check_msg(
|
fail(ctx, err.to_string()).await.unwrap();
|
||||||
msg.channel_id
|
|
||||||
.say(&ctx.http, format!("Failed: {:?}", err))
|
|
||||||
.await,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
check_msg(msg.channel_id.say(&ctx.http, "Deafened").await);
|
ctx.send(
|
||||||
|
CreateReply::default().embed(embed(ctx, "Deafened!", "", "").await.unwrap())
|
||||||
|
).await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -1,29 +1,36 @@
|
|||||||
use serenity::framework::standard::macros::command;
|
use crate::{commands::embeds::{error_embed, embed}, Context, Error};
|
||||||
use serenity::framework::standard::CommandResult;
|
use poise::CreateReply;
|
||||||
use serenity::model::prelude::*;
|
use songbird::TrackEvent;
|
||||||
use serenity::prelude::*;
|
use crate::commands::music::notifier::TrackErrorNotifier;
|
||||||
use songbird::events::TrackEvent;
|
|
||||||
|
|
||||||
use crate::commands::{misc::check_msg, music::misc::TrackErrorNotifier};
|
/// Joins your voice channel
|
||||||
|
#[poise::command(
|
||||||
#[command]
|
prefix_command,
|
||||||
#[only_in(guilds)]
|
slash_command,
|
||||||
async fn join(ctx: &Context, msg: &Message) -> CommandResult {
|
category = "Music"
|
||||||
let guild_id = msg.guild_id.unwrap();
|
)]
|
||||||
let channel_id = msg.guild(&ctx.cache).unwrap().voice_states.get(&msg.author.id).and_then(|voice_state| voice_state.channel_id);
|
pub async fn join(
|
||||||
|
ctx: Context<'_>
|
||||||
|
) -> Result<(), Error> {
|
||||||
|
let guild_id = ctx.guild_id().unwrap();
|
||||||
|
let channel_id = ctx.guild().unwrap()
|
||||||
|
.voice_states.get(&ctx.author().id)
|
||||||
|
.and_then(|voice_state| voice_state.channel_id);
|
||||||
|
|
||||||
let connect_to = match channel_id {
|
let connect_to = match channel_id {
|
||||||
Some(channel) => channel,
|
Some(channel) => channel,
|
||||||
None => {
|
None => {
|
||||||
check_msg(msg.reply(ctx, "Not in a voice channel").await);
|
let msg = "I am not in a voice channel!";
|
||||||
|
ctx.send(
|
||||||
|
CreateReply::default().embed(error_embed(ctx, msg).await.unwrap())
|
||||||
|
).await?;
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let manager = songbird::get(ctx)
|
let manager = songbird::get(&ctx.serenity_context())
|
||||||
.await
|
.await
|
||||||
.expect("Songbird Voice placed at init")
|
.expect("Songbird client placed at init")
|
||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
if let Ok(handler_lock) = manager.join(guild_id, connect_to).await {
|
if let Ok(handler_lock) = manager.join(guild_id, connect_to).await {
|
||||||
@@ -31,5 +38,9 @@ async fn join(ctx: &Context, msg: &Message) -> CommandResult {
|
|||||||
handler.add_global_event(TrackEvent::Error.into(), TrackErrorNotifier);
|
handler.add_global_event(TrackEvent::Error.into(), TrackErrorNotifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx.send(
|
||||||
|
CreateReply::default().embed(embed(ctx, "Joined!", "Hi there!", "").await.unwrap())
|
||||||
|
).await?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +1,40 @@
|
|||||||
use serenity::framework::standard::macros::command;
|
use poise::CreateReply;
|
||||||
use serenity::framework::standard::CommandResult;
|
use crate::{commands::embeds::{error_embed, fail, embed}, Context, Error};
|
||||||
use serenity::model::prelude::*;
|
|
||||||
use serenity::prelude::*;
|
|
||||||
|
|
||||||
use crate::commands::misc::check_msg;
|
/// Leaves the voice channel; \
|
||||||
|
/// aliases: leave, qa!
|
||||||
|
#[poise::command(
|
||||||
|
prefix_command,
|
||||||
|
slash_command,
|
||||||
|
aliases("leave", "qa!"),
|
||||||
|
category = "Music"
|
||||||
|
)]
|
||||||
|
pub async fn leave(
|
||||||
|
ctx: Context<'_>
|
||||||
|
) -> Result<(), Error> {
|
||||||
|
let guild_id = ctx.guild_id().unwrap();
|
||||||
|
|
||||||
#[command]
|
let manager = songbird::get(&ctx.serenity_context())
|
||||||
#[aliases(q)]
|
|
||||||
#[only_in(guilds)]
|
|
||||||
async fn leave(ctx: &Context, msg: &Message) -> CommandResult {
|
|
||||||
let guild_id = msg.guild_id.unwrap();
|
|
||||||
|
|
||||||
let manager = songbird::get(ctx)
|
|
||||||
.await
|
.await
|
||||||
.expect("Client placed in at init")
|
.expect("Songbird client placed at init")
|
||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
let has_handler = manager.get(guild_id).is_some();
|
if !manager.get(guild_id).is_some() {
|
||||||
|
let msg = "I am not in a voice channel!";
|
||||||
|
ctx.send(
|
||||||
|
CreateReply::default().embed(error_embed(ctx, msg).await.unwrap())
|
||||||
|
).await?;
|
||||||
|
|
||||||
if has_handler {
|
return Ok(())
|
||||||
if let Err(err) = manager.remove(guild_id).await {
|
|
||||||
check_msg(
|
|
||||||
msg.channel_id
|
|
||||||
.say(&ctx.http, format!("Failed: {:?}", err))
|
|
||||||
.await,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
check_msg(msg.channel_id.say(&ctx.http, "Left voice channel").await);
|
|
||||||
} else {
|
|
||||||
check_msg(msg.reply(ctx, "Not in a voice channel").await);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Err(err) = manager.remove(guild_id).await {
|
||||||
|
fail(ctx, err.to_string()).await.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.send(
|
||||||
|
CreateReply::default().embed(embed(ctx, "Left!", "I left the voice channel", "").await.unwrap())
|
||||||
|
).await?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,83 +0,0 @@
|
|||||||
use serenity::framework::standard::macros::command;
|
|
||||||
use serenity::framework::standard::{Args, CommandResult};
|
|
||||||
use serenity::model::prelude::*;
|
|
||||||
use serenity::prelude::*;
|
|
||||||
use songbird::tracks::LoopState;
|
|
||||||
|
|
||||||
use crate::commands::misc::check_msg;
|
|
||||||
|
|
||||||
#[command]
|
|
||||||
#[aliases(loop)]
|
|
||||||
#[only_in(guilds)]
|
|
||||||
async fn loopcurrent(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult {
|
|
||||||
let guild_id = msg.guild_id.unwrap();
|
|
||||||
|
|
||||||
let manager = songbird::get(ctx)
|
|
||||||
.await
|
|
||||||
.expect("Client placed at init")
|
|
||||||
.clone();
|
|
||||||
|
|
||||||
|
|
||||||
if let Some(handler_lock) = manager.get(guild_id) {
|
|
||||||
let handler = handler_lock.lock().await;
|
|
||||||
let queue = handler.queue();
|
|
||||||
|
|
||||||
let track = queue.current().unwrap().get_info().await;
|
|
||||||
let is_looped = track.unwrap().loops;
|
|
||||||
|
|
||||||
|
|
||||||
let count = match args.single::<usize>() {
|
|
||||||
Ok(count) => count,
|
|
||||||
Err(_) => 100,
|
|
||||||
};
|
|
||||||
|
|
||||||
match is_looped {
|
|
||||||
LoopState::Infinite => {
|
|
||||||
let _ = queue.current().unwrap().disable_loop();
|
|
||||||
|
|
||||||
check_msg(
|
|
||||||
msg.channel_id
|
|
||||||
.say(
|
|
||||||
&ctx.http,
|
|
||||||
format!("Song unlooped."),
|
|
||||||
)
|
|
||||||
.await,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
LoopState::Finite(_) => {
|
|
||||||
if count < 100 {
|
|
||||||
let _ = queue.current().unwrap().loop_for(count);
|
|
||||||
check_msg(
|
|
||||||
msg.channel_id
|
|
||||||
.say(
|
|
||||||
&ctx.http,
|
|
||||||
format!("Song looped forever (a very long time)."),
|
|
||||||
)
|
|
||||||
.await,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
let _ = queue.current().unwrap().enable_loop();
|
|
||||||
|
|
||||||
check_msg(
|
|
||||||
msg.channel_id
|
|
||||||
.say(
|
|
||||||
&ctx.http,
|
|
||||||
format!("Song looped {} times.", count),
|
|
||||||
)
|
|
||||||
.await,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
check_msg(
|
|
||||||
msg.channel_id
|
|
||||||
.say(&ctx.http, "Not in a voice channel to play in")
|
|
||||||
.await,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
pub mod deafen;
|
|
||||||
pub mod join;
|
|
||||||
pub mod leave;
|
|
||||||
pub mod misc;
|
|
||||||
pub mod mute;
|
|
||||||
pub mod play;
|
|
||||||
pub mod queue;
|
|
||||||
pub mod skip;
|
|
||||||
pub mod stop;
|
|
||||||
pub mod loopcurrent;
|
|
||||||
pub mod pause;
|
|
||||||
pub mod resume;
|
|
||||||
@@ -1,25 +1,31 @@
|
|||||||
use serenity::framework::standard::macros::command;
|
use crate::{commands::embeds::{error_embed, embed, fail}, Context, Error};
|
||||||
use serenity::framework::standard::CommandResult;
|
use poise::CreateReply;
|
||||||
use serenity::model::prelude::*;
|
|
||||||
use serenity::prelude::*;
|
|
||||||
|
|
||||||
use crate::commands::misc::check_msg;
|
/// Mutes itself while in a voice channel; \
|
||||||
|
/// aliases: mute, unmute, shhh
|
||||||
|
#[poise::command(
|
||||||
|
prefix_command,
|
||||||
|
slash_command,
|
||||||
|
aliases("shhh", "unmute"),
|
||||||
|
category = "Music"
|
||||||
|
)]
|
||||||
|
pub async fn mute(
|
||||||
|
ctx: Context<'_>
|
||||||
|
) -> Result<(), Error> {
|
||||||
|
let guild_id = ctx.guild_id().unwrap();
|
||||||
|
|
||||||
#[command]
|
let manager = songbird::get(&ctx.serenity_context())
|
||||||
#[only_in(guilds)]
|
|
||||||
async fn mute(ctx: &Context, msg: &Message) -> CommandResult {
|
|
||||||
let guild_id = msg.guild_id.unwrap();
|
|
||||||
|
|
||||||
let manager = songbird::get(ctx)
|
|
||||||
.await
|
.await
|
||||||
.expect("Client placed at init")
|
.expect("Songbird client placed at init")
|
||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
let handler_lock = match manager.get(guild_id) {
|
let handler_lock = match manager.get(guild_id) {
|
||||||
Some(handler) => handler,
|
Some(handler) => handler,
|
||||||
None => {
|
None => {
|
||||||
check_msg(msg.reply(ctx, "Not in a voice channel").await);
|
let msg = "I am not in a voice channel!";
|
||||||
|
ctx.send(
|
||||||
|
CreateReply::default().embed(error_embed(ctx, msg).await.unwrap())
|
||||||
|
).await?;
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -27,25 +33,21 @@ async fn mute(ctx: &Context, msg: &Message) -> CommandResult {
|
|||||||
let mut handler = handler_lock.lock().await;
|
let mut handler = handler_lock.lock().await;
|
||||||
|
|
||||||
if handler.is_mute() {
|
if handler.is_mute() {
|
||||||
if let Err(e) = handler.mute(false).await {
|
if let Err(err) = handler.mute(false).await {
|
||||||
check_msg(
|
fail(ctx, err.to_string()).await.unwrap();
|
||||||
msg.channel_id
|
|
||||||
.say(&ctx.http, format!("failed: {:?}", e))
|
|
||||||
.await,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
check_msg(msg.channel_id.say(&ctx.http, "Unmuted").await);
|
ctx.send(
|
||||||
|
CreateReply::default().embed(embed(ctx, "Unmuted!", "", "").await.unwrap())
|
||||||
|
).await?;
|
||||||
} else {
|
} else {
|
||||||
if let Err(err) = handler.mute(true).await {
|
if let Err(err) = handler.mute(true).await {
|
||||||
check_msg(
|
fail(ctx, err.to_string()).await.unwrap();
|
||||||
msg.channel_id
|
|
||||||
.say(&ctx.http, format!("Failed: {:?}", err))
|
|
||||||
.await,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
check_msg(msg.channel_id.say(&ctx.http, "Muted").await);
|
ctx.send(
|
||||||
|
CreateReply::default().embed(embed(ctx, "Muted!", "", "").await.unwrap())
|
||||||
|
).await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -1,18 +1,20 @@
|
|||||||
use serenity::framework::standard::macros::command;
|
use crate::{commands::embeds::{error_embed, embed}, Context, Error};
|
||||||
use serenity::framework::standard::CommandResult;
|
use poise::CreateReply;
|
||||||
use serenity::model::prelude::*;
|
|
||||||
use serenity::prelude::*;
|
|
||||||
|
|
||||||
use crate::commands::misc::check_msg;
|
/// Pauses the currently playing song
|
||||||
|
#[poise::command(
|
||||||
|
prefix_command,
|
||||||
|
slash_command,
|
||||||
|
category = "Music"
|
||||||
|
)]
|
||||||
|
pub async fn pause(
|
||||||
|
ctx: Context<'_>
|
||||||
|
) -> Result<(), Error> {
|
||||||
|
let guild_id = ctx.guild_id().unwrap();
|
||||||
|
|
||||||
#[command]
|
let manager = songbird::get(&ctx.serenity_context())
|
||||||
#[only_in(guilds)]
|
|
||||||
async fn pause(ctx: &Context, msg: &Message) -> CommandResult {
|
|
||||||
let guild_id = msg.guild_id.unwrap();
|
|
||||||
|
|
||||||
let manager = songbird::get(ctx)
|
|
||||||
.await
|
.await
|
||||||
.expect("Client placed at init")
|
.expect("Songbird client placed at init")
|
||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
if let Some(handler_lock) = manager.get(guild_id) {
|
if let Some(handler_lock) = manager.get(guild_id) {
|
||||||
@@ -20,20 +22,14 @@ async fn pause(ctx: &Context, msg: &Message) -> CommandResult {
|
|||||||
let queue = handler.queue();
|
let queue = handler.queue();
|
||||||
let _ = queue.pause();
|
let _ = queue.pause();
|
||||||
|
|
||||||
check_msg(
|
ctx.send(
|
||||||
msg.channel_id
|
CreateReply::default().embed(embed(ctx, "Paused!", "Currently playing song is now paused!", "").await.unwrap())
|
||||||
.say(
|
).await?;
|
||||||
&ctx.http,
|
|
||||||
format!("Song paused."),
|
|
||||||
)
|
|
||||||
.await,
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
check_msg(
|
let msg = "I am not in a voice channel!";
|
||||||
msg.channel_id
|
ctx.send(
|
||||||
.say(&ctx.http, "Not in a voice channel to play in")
|
CreateReply::default().embed(error_embed(ctx, msg).await.unwrap())
|
||||||
.await,
|
).await?;
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -1,58 +1,66 @@
|
|||||||
use serenity::framework::standard::macros::command;
|
use crate::{commands::embeds::error_embed, Context, Error};
|
||||||
use serenity::framework::standard::{Args, CommandResult};
|
|
||||||
use serenity::model::prelude::*;
|
use fancy_regex::Regex;
|
||||||
use serenity::prelude::*;
|
use regex::Regex as Regex_Classic;
|
||||||
use reqwest::Client as HttpClient;
|
use std::process::Command;
|
||||||
|
use std::time::Duration;
|
||||||
|
use poise::CreateReply;
|
||||||
|
use poise::serenity_prelude::CreateEmbed;
|
||||||
|
use poise::serenity_prelude::Colour;
|
||||||
|
use poise::serenity_prelude::model::Timestamp;
|
||||||
|
use serenity::builder::CreateEmbedAuthor;
|
||||||
|
use serenity::builder::CreateEmbedFooter;
|
||||||
|
use songbird::input::AuxMetadata;
|
||||||
use songbird::input::{Compose, YoutubeDl};
|
use songbird::input::{Compose, YoutubeDl};
|
||||||
use songbird::events::TrackEvent;
|
use songbird::events::TrackEvent;
|
||||||
|
|
||||||
use crate::commands::{misc::check_msg, music::misc::TrackErrorNotifier};
|
use crate::commands::music::notifier::TrackErrorNotifier;
|
||||||
|
use crate::http::HttpKey;
|
||||||
|
|
||||||
pub struct HttpKey;
|
/// Plays a song; \
|
||||||
|
/// you can search by query or paste an url; \
|
||||||
|
/// aliases: play, p, enqueue
|
||||||
|
#[poise::command(
|
||||||
|
prefix_command,
|
||||||
|
slash_command,
|
||||||
|
aliases("p", "enqueue"),
|
||||||
|
category = "Music"
|
||||||
|
)]
|
||||||
|
pub async fn play(
|
||||||
|
ctx: Context<'_>,
|
||||||
|
#[description = "Provide a query or an url"] #[rest] mut song: String,
|
||||||
|
) -> Result<(), Error> {
|
||||||
|
let regex_spotify = Regex::new(r"https?:\/\/(?:embed\.|open\.)(?:spotify\.com\/)(?:track\/|\?uri=spotify:track:)((\w|-)+)(?:(?=\?)(?:[?&]foo=(\d*)(?=[&#]|$)|(?![?&]foo=)[^#])+)?(?=#|$)").unwrap();
|
||||||
|
let regex_youtube = Regex_Classic::new(r#""url": "(https://www.youtube.com/watch\?v=[A-Za-z0-9]{11})""#).unwrap();
|
||||||
|
let regex_youtube_playlist = Regex::new(r"^((?:https?:)\/\/)?((?:www|m)\.)?((?:youtube\.com)).*(youtu.be\/|list=)([^#&?]*).*").unwrap();
|
||||||
|
|
||||||
impl TypeMapKey for HttpKey {
|
let is_playlist = regex_youtube_playlist.is_match(&song).unwrap();
|
||||||
type Value = HttpClient;
|
let is_spotify = regex_spotify.is_match(&song).unwrap();
|
||||||
}
|
let is_query = !song.starts_with("http");
|
||||||
|
|
||||||
#[command]
|
let guild_id = ctx.guild_id().unwrap();
|
||||||
#[aliases(p)]
|
let channel_id = ctx.guild().unwrap().voice_states.get(&ctx.author().id).and_then(|voice_state| voice_state.channel_id);
|
||||||
#[only_in(guilds)]
|
|
||||||
async fn play(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult {
|
|
||||||
let url = match args.single::<String>() {
|
|
||||||
Ok(url) => url,
|
|
||||||
Err(_) => {
|
|
||||||
check_msg(
|
|
||||||
msg.channel_id
|
|
||||||
.say(&ctx.http, "Must provide a URL to a video or audio")
|
|
||||||
.await,
|
|
||||||
);
|
|
||||||
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
let is_search = !url.starts_with("http");
|
|
||||||
|
|
||||||
let guild_id = msg.guild_id.unwrap();
|
|
||||||
let channel_id = msg.guild(&ctx.cache).unwrap().voice_states.get(&msg.author.id).and_then(|voice_state| voice_state.channel_id);
|
|
||||||
|
|
||||||
let connect_to = match channel_id {
|
let connect_to = match channel_id {
|
||||||
Some(channel) => channel,
|
Some(channel) => channel,
|
||||||
None => {
|
None => {
|
||||||
check_msg(msg.reply(ctx, "Not in a voice channel").await);
|
let msg = "I am not in a voice channel!";
|
||||||
|
ctx.send(
|
||||||
|
CreateReply::default().embed(error_embed(ctx, msg).await.unwrap())
|
||||||
|
).await?;
|
||||||
|
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let http_client = {
|
let http_client = {
|
||||||
let data = ctx.data.read().await;
|
let data = ctx.serenity_context().data.read().await;
|
||||||
data.get::<HttpKey>()
|
data.get::<HttpKey>()
|
||||||
.cloned()
|
.cloned()
|
||||||
.expect("Guaranteed to exist in the typemap.")
|
.expect("Guaranteed to exist in the typemap.")
|
||||||
};
|
};
|
||||||
|
|
||||||
let manager = songbird::get(ctx)
|
let manager = songbird::get(&ctx.serenity_context())
|
||||||
.await
|
.await
|
||||||
.expect("Songbird Voice placed at init")
|
.expect("Songbird Voice placed at init")
|
||||||
.clone();
|
.clone();
|
||||||
@@ -60,28 +68,100 @@ async fn play(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult {
|
|||||||
if let Ok(handler_lock) = manager.join(guild_id, connect_to).await {
|
if let Ok(handler_lock) = manager.join(guild_id, connect_to).await {
|
||||||
let mut handler = handler_lock.lock().await;
|
let mut handler = handler_lock.lock().await;
|
||||||
|
|
||||||
// if let Err(err) = handler.deafen(true).await {println!("Failed to deafen: {:?}", err)};
|
|
||||||
handler.add_global_event(TrackEvent::Error.into(), TrackErrorNotifier);
|
handler.add_global_event(TrackEvent::Error.into(), TrackErrorNotifier);
|
||||||
|
|
||||||
let mut src = if is_search {
|
if is_playlist {
|
||||||
println!("ytsearch:{}", url);
|
let raw_list = Command::new("yt-dlp")
|
||||||
YoutubeDl::new_ytdl_like("yt-dlp", http_client, format!("ytsearch:{}", args.clone().message()))
|
.args(["-j", "--flat-playlist", &song])
|
||||||
|
.output()
|
||||||
|
.expect("failed to execute process")
|
||||||
|
.stdout;
|
||||||
|
|
||||||
|
let list = String::from_utf8(raw_list.clone()).expect("Invalid UTF-8");
|
||||||
|
|
||||||
|
let urls: Vec<String> = regex_youtube.captures_iter(&list).map(|capture| capture[1].to_string()).collect();
|
||||||
|
|
||||||
|
let mut sources: Vec<YoutubeDl> = vec![];
|
||||||
|
|
||||||
|
for url in urls {
|
||||||
|
let src = YoutubeDl::new_ytdl_like("yt-dlp", http_client.clone(), url);
|
||||||
|
let _ = handler.enqueue_input(src.clone().into()).await;
|
||||||
|
sources.push(src);
|
||||||
|
}
|
||||||
|
|
||||||
|
let embed = generate_playlist_embed(ctx, sources).await;
|
||||||
|
let response = CreateReply::default().embed(embed.unwrap());
|
||||||
|
ctx.send(response).await?;
|
||||||
} else {
|
} else {
|
||||||
YoutubeDl::new_ytdl_like("yt-dlp", http_client, url)
|
if is_spotify {
|
||||||
};
|
let exec = format!("node ./src/spotify --url {}", song);
|
||||||
|
let query = Command::new("sh").arg("-c").arg(exec).output().expect("failed to execute process").stdout;
|
||||||
|
let query_str = String::from_utf8(query.clone()).expect("Invalid UTF-8");
|
||||||
|
song = format!("ytsearch:{}", query_str.to_string());
|
||||||
|
|
||||||
let _ = handler.enqueue_input(src.clone().into()).await;
|
}
|
||||||
|
|
||||||
let metadata = src.aux_metadata().await.unwrap();
|
if is_query {
|
||||||
|
song = format!("ytsearch:{}", song);
|
||||||
|
}
|
||||||
|
|
||||||
check_msg(msg.channel_id.say(&ctx.http, format!("Playing song: {}", metadata.title.unwrap())).await);
|
let src = YoutubeDl::new_ytdl_like("yt-dlp", http_client, song);
|
||||||
} else {
|
let _ = handler.enqueue_input(src.clone().into()).await;
|
||||||
check_msg(
|
|
||||||
msg.channel_id
|
let embed = generate_embed(ctx, src).await;
|
||||||
.say(&ctx.http, "Not in a voice channel to play in")
|
let response = CreateReply::default().embed(embed.unwrap());
|
||||||
.await,
|
ctx.send(response).await?;
|
||||||
);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn generate_embed(ctx: Context<'_>, src: YoutubeDl) -> Result<CreateEmbed, Error> {
|
||||||
|
let metadata = src.clone().aux_metadata().await.unwrap();
|
||||||
|
let AuxMetadata {title, thumbnail, source_url, artist, duration, ..} = metadata;
|
||||||
|
let timestamp = Timestamp::now();
|
||||||
|
let duration_minutes = duration.unwrap_or(Duration::new(0, 0)).clone().as_secs() / 60;
|
||||||
|
let duration_seconds = duration.unwrap_or(Duration::new(0, 0)).clone().as_secs() % 60;
|
||||||
|
|
||||||
|
let embed = CreateEmbed::default()
|
||||||
|
.author(CreateEmbedAuthor::new("Track enqueued").icon_url(ctx.author().clone().face()))
|
||||||
|
.colour(Colour::from_rgb(255, 58, 97))
|
||||||
|
.title(title.unwrap())
|
||||||
|
.url(source_url.unwrap())
|
||||||
|
.thumbnail(thumbnail.unwrap_or(ctx.cache().current_user().face()))
|
||||||
|
.field("Artist", artist.unwrap_or("Unknown Artist".to_string()), true)
|
||||||
|
.field("Duration", format!("{:02}:{:02}", duration_minutes, duration_seconds), true)
|
||||||
|
.field("DJ", ctx.author().name.clone(), true)
|
||||||
|
.timestamp(timestamp)
|
||||||
|
.footer(CreateEmbedFooter::new(ctx.cache().current_user().name.to_string()).icon_url(ctx.cache().current_user().face()));
|
||||||
|
|
||||||
|
Ok(embed)
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn generate_playlist_embed(ctx: Context<'_>, sources: Vec<YoutubeDl>) -> Result<CreateEmbed, Error> {
|
||||||
|
let src = sources.get(0).unwrap();
|
||||||
|
|
||||||
|
let metadata = src.clone().aux_metadata().await.unwrap();
|
||||||
|
let AuxMetadata {title, thumbnail, source_url, artist, duration, ..} = metadata;
|
||||||
|
let timestamp = Timestamp::now();
|
||||||
|
let duration_minutes = duration.unwrap_or(Duration::new(0, 0)).clone().as_secs() / 60;
|
||||||
|
let duration_seconds = duration.unwrap_or(Duration::new(0, 0)).clone().as_secs() % 60;
|
||||||
|
|
||||||
|
let description = format!("Enqueued tracks: {}", sources.len() - 1);
|
||||||
|
|
||||||
|
let embed = CreateEmbed::default()
|
||||||
|
.author(CreateEmbedAuthor::new("Playlist enqueued").icon_url(ctx.author().clone().face()))
|
||||||
|
.colour(Colour::from_rgb(255, 58, 97))
|
||||||
|
.title(title.unwrap())
|
||||||
|
.url(source_url.unwrap())
|
||||||
|
.thumbnail(thumbnail.unwrap_or(ctx.cache().current_user().face()))
|
||||||
|
.field("Artist", artist.unwrap_or("Unknown Artist".to_string()), true)
|
||||||
|
.field("Duration", format!("{:02}:{:02}", duration_minutes, duration_seconds), true)
|
||||||
|
.field("DJ", ctx.author().name.clone(), true)
|
||||||
|
.description(description)
|
||||||
|
.timestamp(timestamp)
|
||||||
|
.footer(CreateEmbedFooter::new(ctx.cache().current_user().name.to_string()).icon_url(ctx.cache().current_user().face()));
|
||||||
|
|
||||||
|
Ok(embed)
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,18 +1,22 @@
|
|||||||
use serenity::framework::standard::macros::command;
|
use crate::{commands::embeds::error_embed, Context, Error};
|
||||||
use serenity::framework::standard::CommandResult;
|
use poise::CreateReply;
|
||||||
use serenity::model::prelude::*;
|
|
||||||
use serenity::prelude::*;
|
|
||||||
|
|
||||||
use crate::commands::misc::check_msg;
|
/// Shows next tracks in queue; \
|
||||||
|
/// aliases: queue, q
|
||||||
|
#[poise::command(
|
||||||
|
prefix_command,
|
||||||
|
slash_command,
|
||||||
|
aliases("q"),
|
||||||
|
category = "Music"
|
||||||
|
)]
|
||||||
|
pub async fn queue(
|
||||||
|
ctx: Context<'_>
|
||||||
|
) -> Result<(), Error> {
|
||||||
|
let guild_id = ctx.guild_id().unwrap();
|
||||||
|
|
||||||
#[command]
|
let manager = songbird::get(&ctx.serenity_context())
|
||||||
#[only_in(guilds)]
|
|
||||||
async fn queue(ctx: &Context, msg: &Message) -> CommandResult {
|
|
||||||
let guild_id = msg.guild_id.unwrap();
|
|
||||||
|
|
||||||
let manager = songbird::get(ctx)
|
|
||||||
.await
|
.await
|
||||||
.expect("Client placed at init")
|
.expect("Songbird client placed at init")
|
||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
if let Some(handler_lock) = manager.get(guild_id) {
|
if let Some(handler_lock) = manager.get(guild_id) {
|
||||||
@@ -27,21 +31,16 @@ async fn queue(ctx: &Context, msg: &Message) -> CommandResult {
|
|||||||
song.uuid(),
|
song.uuid(),
|
||||||
"Artist"
|
"Artist"
|
||||||
// song.metadata().artist.clone().unwrap_or_else(|| String::from("Unknown"))
|
// song.metadata().artist.clone().unwrap_or_else(|| String::from("Unknown"))
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
check_msg(
|
ctx.say(queue_res).await?;
|
||||||
msg.channel_id
|
|
||||||
.say(&ctx.http, queue_res)
|
|
||||||
.await,
|
|
||||||
);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
check_msg(
|
let msg = "I am not in a voice channel!";
|
||||||
msg.channel_id
|
ctx.send(
|
||||||
.say(&ctx.http, "Not in a voice channel!")
|
CreateReply::default().embed(error_embed(ctx, msg).await.unwrap())
|
||||||
.await,
|
).await?;
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
70
src/commands/music/repeat.rs
Normal file
70
src/commands/music/repeat.rs
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
use crate::{commands::embeds::{error_embed, embed}, Context, Error};
|
||||||
|
use poise::CreateReply;
|
||||||
|
use songbird::tracks::LoopState;
|
||||||
|
|
||||||
|
/// Loops currently playing song provided amount of times; \
|
||||||
|
/// aliases: repeat, loop, while, for
|
||||||
|
#[poise::command(
|
||||||
|
prefix_command,
|
||||||
|
slash_command,
|
||||||
|
aliases("loop", "while", "for"),
|
||||||
|
category = "Music"
|
||||||
|
)]
|
||||||
|
pub async fn repeat(
|
||||||
|
ctx: Context<'_>,
|
||||||
|
#[description = "How many times"] #[rest] times: usize
|
||||||
|
) -> Result<(), Error> {
|
||||||
|
let guild_id = ctx.guild_id().unwrap();
|
||||||
|
|
||||||
|
let manager = songbird::get(&ctx.serenity_context())
|
||||||
|
.await
|
||||||
|
.expect("Songbird client placed at init")
|
||||||
|
.clone();
|
||||||
|
|
||||||
|
|
||||||
|
if let Some(handler_lock) = manager.get(guild_id) {
|
||||||
|
let handler = handler_lock.lock().await;
|
||||||
|
let queue = handler.queue();
|
||||||
|
|
||||||
|
let track = queue.current().unwrap().get_info().await;
|
||||||
|
let is_looped = track.unwrap().loops;
|
||||||
|
|
||||||
|
match is_looped {
|
||||||
|
LoopState::Infinite => {
|
||||||
|
let _ = queue.current().unwrap().disable_loop();
|
||||||
|
|
||||||
|
ctx.send(
|
||||||
|
CreateReply::default().embed(embed(ctx, "Song Unlooped!", "", "").await.unwrap())
|
||||||
|
).await?;
|
||||||
|
}
|
||||||
|
LoopState::Finite(_) => {
|
||||||
|
if times == 0 {
|
||||||
|
let _ = queue.current().unwrap().disable_loop();
|
||||||
|
|
||||||
|
ctx.send(
|
||||||
|
CreateReply::default().embed(embed(ctx, "Song Unlooped!", "", "").await.unwrap())
|
||||||
|
).await?;
|
||||||
|
}
|
||||||
|
else if times < 100 {
|
||||||
|
let _ = queue.current().unwrap().loop_for(times);
|
||||||
|
ctx.send(
|
||||||
|
CreateReply::default().embed(embed(ctx, &format!("Song looped {} times!", times), "You definitelly love this song!", "").await.unwrap())
|
||||||
|
).await?;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
let _ = queue.current().unwrap().enable_loop();
|
||||||
|
ctx.send(
|
||||||
|
CreateReply::default().embed(embed(ctx, "Song looped forever!", "A very long time!", "").await.unwrap())
|
||||||
|
).await?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let msg = "I am not in a voice channel!";
|
||||||
|
ctx.send(
|
||||||
|
CreateReply::default().embed(error_embed(ctx, msg).await.unwrap())
|
||||||
|
).await?;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
@@ -1,18 +1,20 @@
|
|||||||
use serenity::framework::standard::macros::command;
|
use crate::{commands::embeds::{error_embed, embed}, Context, Error};
|
||||||
use serenity::framework::standard::CommandResult;
|
use poise::CreateReply;
|
||||||
use serenity::model::prelude::*;
|
|
||||||
use serenity::prelude::*;
|
|
||||||
|
|
||||||
use crate::commands::misc::check_msg;
|
/// Resumes currently paused song
|
||||||
|
#[poise::command(
|
||||||
|
prefix_command,
|
||||||
|
slash_command,
|
||||||
|
category = "Music"
|
||||||
|
)]
|
||||||
|
pub async fn resume(
|
||||||
|
ctx: Context<'_>
|
||||||
|
) -> Result<(), Error> {
|
||||||
|
let guild_id = ctx.guild_id().unwrap();
|
||||||
|
|
||||||
#[command]
|
let manager = songbird::get(&ctx.serenity_context())
|
||||||
#[only_in(guilds)]
|
|
||||||
async fn resume(ctx: &Context, msg: &Message) -> CommandResult {
|
|
||||||
let guild_id = msg.guild_id.unwrap();
|
|
||||||
|
|
||||||
let manager = songbird::get(ctx)
|
|
||||||
.await
|
.await
|
||||||
.expect("Client placed at init")
|
.expect("Songbird client placed at init")
|
||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
if let Some(handler_lock) = manager.get(guild_id) {
|
if let Some(handler_lock) = manager.get(guild_id) {
|
||||||
@@ -20,20 +22,15 @@ async fn resume(ctx: &Context, msg: &Message) -> CommandResult {
|
|||||||
let queue = handler.queue();
|
let queue = handler.queue();
|
||||||
let _ = queue.resume();
|
let _ = queue.resume();
|
||||||
|
|
||||||
check_msg(
|
ctx.say(format!("Song resumed.")).await?;
|
||||||
msg.channel_id
|
ctx.send(
|
||||||
.say(
|
CreateReply::default().embed(embed(ctx, "Resumed!", "Currently paused song is now resumed!", "").await.unwrap())
|
||||||
&ctx.http,
|
).await?;
|
||||||
format!("Song resumed."),
|
|
||||||
)
|
|
||||||
.await,
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
check_msg(
|
let msg = "I am not in a voice channel!";
|
||||||
msg.channel_id
|
ctx.send(
|
||||||
.say(&ctx.http, "Not in a voice channel to play in")
|
CreateReply::default().embed(error_embed(ctx, msg).await.unwrap())
|
||||||
.await,
|
).await?;
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -1,18 +1,20 @@
|
|||||||
use serenity::framework::standard::macros::command;
|
use crate::{commands::embeds::{error_embed, embed}, Context, Error};
|
||||||
use serenity::framework::standard::CommandResult;
|
use poise::CreateReply;
|
||||||
use serenity::model::prelude::*;
|
|
||||||
use serenity::prelude::*;
|
|
||||||
|
|
||||||
use crate::commands::misc::check_msg;
|
/// Skips the currently playing song
|
||||||
|
#[poise::command(
|
||||||
|
prefix_command,
|
||||||
|
slash_command,
|
||||||
|
category = "Music"
|
||||||
|
)]
|
||||||
|
pub async fn skip(
|
||||||
|
ctx: Context<'_>
|
||||||
|
) -> Result<(), Error> {
|
||||||
|
let guild_id = ctx.guild_id().unwrap();
|
||||||
|
|
||||||
#[command]
|
let manager = songbird::get(&ctx.serenity_context())
|
||||||
#[only_in(guilds)]
|
|
||||||
async fn skip(ctx: &Context, msg: &Message) -> CommandResult {
|
|
||||||
let guild_id = msg.guild_id.unwrap();
|
|
||||||
|
|
||||||
let manager = songbird::get(ctx)
|
|
||||||
.await
|
.await
|
||||||
.expect("Client placed at init")
|
.expect("Songbird client placed at init")
|
||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
if let Some(handler_lock) = manager.get(guild_id) {
|
if let Some(handler_lock) = manager.get(guild_id) {
|
||||||
@@ -20,20 +22,14 @@ async fn skip(ctx: &Context, msg: &Message) -> CommandResult {
|
|||||||
let queue = handler.queue();
|
let queue = handler.queue();
|
||||||
let _ = queue.skip();
|
let _ = queue.skip();
|
||||||
|
|
||||||
check_msg(
|
ctx.send(
|
||||||
msg.channel_id
|
CreateReply::default().embed(embed(ctx, "Skipped!", "Next song: {song}", &format!("Songs left in queue: {}", queue.len())).await.unwrap())
|
||||||
.say(
|
).await?;
|
||||||
&ctx.http,
|
|
||||||
format!("Song skipped: {} in queue.", queue.len()),
|
|
||||||
)
|
|
||||||
.await,
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
check_msg(
|
let msg = "I am not in a voice channel!";
|
||||||
msg.channel_id
|
ctx.send(
|
||||||
.say(&ctx.http, "Not in a voice channel to play in")
|
CreateReply::default().embed(error_embed(ctx, msg).await.unwrap())
|
||||||
.await,
|
).await?;
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -1,18 +1,22 @@
|
|||||||
use serenity::framework::standard::macros::command;
|
use crate::{commands::embeds::{error_embed, embed}, Context, Error};
|
||||||
use serenity::framework::standard::CommandResult;
|
use poise::CreateReply;
|
||||||
use serenity::model::prelude::*;
|
|
||||||
use serenity::prelude::*;
|
|
||||||
|
|
||||||
use crate::commands::misc::check_msg;
|
/// Stops playback and destroys the queue; \
|
||||||
|
/// aliases: stop, end
|
||||||
|
#[poise::command(
|
||||||
|
prefix_command,
|
||||||
|
slash_command,
|
||||||
|
aliases("end"),
|
||||||
|
category = "Music"
|
||||||
|
)]
|
||||||
|
pub async fn stop(
|
||||||
|
ctx: Context<'_>
|
||||||
|
) -> Result<(), Error> {
|
||||||
|
let guild_id = ctx.guild_id().unwrap();
|
||||||
|
|
||||||
#[command]
|
let manager = songbird::get(&ctx.serenity_context())
|
||||||
#[only_in(guilds)]
|
|
||||||
async fn stop(ctx: &Context, msg: &Message) -> CommandResult {
|
|
||||||
let guild_id = msg.guild_id.unwrap();
|
|
||||||
|
|
||||||
let manager = songbird::get(ctx)
|
|
||||||
.await
|
.await
|
||||||
.expect("Client placed at init")
|
.expect("Songbird client placed at init")
|
||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
if let Some(handler_lock) = manager.get(guild_id) {
|
if let Some(handler_lock) = manager.get(guild_id) {
|
||||||
@@ -20,13 +24,14 @@ async fn stop(ctx: &Context, msg: &Message) -> CommandResult {
|
|||||||
let queue = handler.queue();
|
let queue = handler.queue();
|
||||||
queue.stop();
|
queue.stop();
|
||||||
|
|
||||||
check_msg(msg.channel_id.say(&ctx.http, "Playback stopped!").await);
|
ctx.send(
|
||||||
|
CreateReply::default().embed(embed(ctx, "Stopped!", "Playback stopped!", "Queue destroyed! Bot will stay and chill with you in a vc").await.unwrap())
|
||||||
|
).await?;
|
||||||
} else {
|
} else {
|
||||||
check_msg(
|
let msg = "I am not in a voice channel!";
|
||||||
msg.channel_id
|
ctx.send(
|
||||||
.say(&ctx.http, "Not in a voice channel!")
|
CreateReply::default().embed(error_embed(ctx, msg).await.unwrap())
|
||||||
.await,
|
).await?;
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
7
src/commands/tools.rs
Normal file
7
src/commands/tools.rs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
pub mod ping;
|
||||||
|
pub mod register;
|
||||||
|
pub mod help;
|
||||||
|
|
||||||
|
pub use ping::ping;
|
||||||
|
pub use register::register;
|
||||||
|
pub use help::help;
|
||||||
23
src/commands/tools/help.rs
Normal file
23
src/commands/tools/help.rs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
use crate::{Context, Error};
|
||||||
|
|
||||||
|
/// Prints this help message; aliases: help, huh, welp
|
||||||
|
#[poise::command(
|
||||||
|
prefix_command,
|
||||||
|
slash_command,
|
||||||
|
track_edits,
|
||||||
|
aliases("huh", "welp"),
|
||||||
|
category = "Help"
|
||||||
|
)]
|
||||||
|
pub async fn help(
|
||||||
|
ctx: Context<'_>,
|
||||||
|
#[description = "Specific command to show help about"] command: Option<String>,
|
||||||
|
) -> Result<(), Error> {
|
||||||
|
let config = poise::builtins::HelpConfiguration {
|
||||||
|
extra_text_at_bottom: "\
|
||||||
|
Use /help command for more info on a command.
|
||||||
|
You can edit you message to the bot and the bot will edit its response.",
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
poise::builtins::help(ctx, command.as_deref(), config).await?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
@@ -1 +0,0 @@
|
|||||||
pub mod ping;
|
|
||||||
@@ -1,8 +1,15 @@
|
|||||||
use crate::{Context, Error};
|
use crate::{Context, Error};
|
||||||
use std::time::SystemTime;
|
use std::time::SystemTime;
|
||||||
|
|
||||||
#[poise::command(prefix_command, slash_command)]
|
/// Pings you backs with a response time
|
||||||
pub async fn ping(ctx: Context<'_>) -> Result<(), Error> {
|
#[poise::command(
|
||||||
|
prefix_command,
|
||||||
|
slash_command,
|
||||||
|
category = "Tools"
|
||||||
|
)]
|
||||||
|
pub async fn ping(
|
||||||
|
ctx: Context<'_>
|
||||||
|
) -> Result<(), Error> {
|
||||||
let system_now = SystemTime::now()
|
let system_now = SystemTime::now()
|
||||||
.duration_since(SystemTime::UNIX_EPOCH)
|
.duration_since(SystemTime::UNIX_EPOCH)
|
||||||
.unwrap().as_millis() as i64;
|
.unwrap().as_millis() as i64;
|
||||||
|
|||||||
13
src/commands/tools/register.rs
Normal file
13
src/commands/tools/register.rs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
use crate::{Context, Error};
|
||||||
|
|
||||||
|
#[poise::command(
|
||||||
|
prefix_command,
|
||||||
|
hide_in_help,
|
||||||
|
owners_only
|
||||||
|
)]
|
||||||
|
pub async fn register(
|
||||||
|
ctx: Context<'_>
|
||||||
|
) -> Result<(), Error> {
|
||||||
|
poise::builtins::register_application_commands_buttons(ctx).await?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
8
src/http.rs
Normal file
8
src/http.rs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
use reqwest::Client as HttpClient;
|
||||||
|
use poise::serenity_prelude::prelude::TypeMapKey;
|
||||||
|
|
||||||
|
pub struct HttpKey;
|
||||||
|
|
||||||
|
impl TypeMapKey for HttpKey {
|
||||||
|
type Value = HttpClient;
|
||||||
|
}
|
||||||
71
src/main.rs
71
src/main.rs
@@ -1,30 +1,17 @@
|
|||||||
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;
|
||||||
|
|
||||||
mod commands;
|
mod commands;
|
||||||
|
mod http;
|
||||||
|
|
||||||
// commands: music
|
use crate::commands::kashi;
|
||||||
use crate::commands::music::deafen::*;
|
use crate::commands::music;
|
||||||
use crate::commands::music::join::*;
|
use crate::commands::tools;
|
||||||
use crate::commands::music::leave::*;
|
use crate::http::HttpKey;
|
||||||
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::loopcurrent::*;
|
|
||||||
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>;
|
||||||
@@ -45,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.");
|
||||||
|
|
||||||
@@ -62,24 +41,21 @@ 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(),
|
||||||
loopcurrent(),
|
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
|
tools::help(),
|
||||||
kashi(),
|
|
||||||
// commands: debug
|
|
||||||
register(),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
let options = poise::FrameworkOptions {
|
let options = poise::FrameworkOptions {
|
||||||
@@ -144,6 +120,7 @@ async fn main() {
|
|||||||
let mut client = serenity::ClientBuilder::new(token, intents)
|
let mut client = serenity::ClientBuilder::new(token, intents)
|
||||||
.framework(framework)
|
.framework(framework)
|
||||||
.register_songbird()
|
.register_songbird()
|
||||||
|
.type_map_insert::<HttpKey>(HttpClient::new())
|
||||||
.await
|
.await
|
||||||
.expect("Error creating client");
|
.expect("Error creating client");
|
||||||
|
|
||||||
|
|||||||
1
src/spotify
Submodule
1
src/spotify
Submodule
Submodule src/spotify added at ea246e9ed2
Reference in New Issue
Block a user