Compare commits
3 commits
d3f689d958
...
f46b3acc8c
Author | SHA1 | Date | |
---|---|---|---|
f46b3acc8c | |||
b98934f79b | |||
98c417656b |
9 changed files with 58 additions and 16 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -12,4 +12,6 @@
|
|||
|
||||
mooverdb.db*
|
||||
|
||||
*.txt
|
||||
*.txt
|
||||
|
||||
Cargo.lock
|
||||
|
|
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -2061,7 +2061,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "moover_rust"
|
||||
version = "3.3.1"
|
||||
version = "3.4.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"chrono",
|
||||
|
@ -4036,7 +4036,7 @@ dependencies = [
|
|||
"json",
|
||||
"regex",
|
||||
"reqwest 0.12.12",
|
||||
"thiserror 1.0.64",
|
||||
"thiserror 2.0.11",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "moover_rust"
|
||||
version = "3.3.1"
|
||||
version = "3.4.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
@ -23,7 +23,7 @@ tenorv2 = { path = "./tenor-v2/tenorv2" }
|
|||
songbird = { version = "0.4.6", features = ["driver", "builtin-queue"] }
|
||||
reqwest = "0.11.27" # songbird depends on ^0.11
|
||||
# radiobrowser = "0.6.1"
|
||||
radiobrowser = { path = "./radiobrowser" }
|
||||
radiobrowser = { path = "./radiobrowser-lib-rust" }
|
||||
|
||||
[dependencies.symphonia]
|
||||
version = "0.5.2"
|
||||
|
|
|
@ -4,10 +4,12 @@ pub use user_interactions::*;
|
|||
// pub use other::*;
|
||||
pub use voice::*;
|
||||
// pub use command_utils::*;
|
||||
pub use help::*;
|
||||
|
||||
pub mod moover;
|
||||
pub mod notice;
|
||||
pub mod user_interactions;
|
||||
// pub mod other;
|
||||
pub mod voice;
|
||||
// mod command_utils;
|
||||
// mod command_utils;\
|
||||
pub mod help;
|
||||
|
|
34
src/commands/help.rs
Normal file
34
src/commands/help.rs
Normal file
|
@ -0,0 +1,34 @@
|
|||
use poise::samples::HelpConfiguration;
|
||||
|
||||
use crate::types::Context;
|
||||
|
||||
type Error = Box<dyn std::error::Error + Send + Sync>;
|
||||
|
||||
/// Show help message
|
||||
#[poise::command(slash_command, track_edits, category = "Utility")]
|
||||
pub async fn help(
|
||||
ctx: Context<'_>,
|
||||
#[description = "Command to get help for"]
|
||||
#[rest]
|
||||
mut command: Option<String>,
|
||||
) -> Result<(), Error> {
|
||||
// This makes it possible to just make `help` a subcommand of any command
|
||||
if ctx.invoked_command_name() != "help" {
|
||||
command = match command {
|
||||
Some(c) => Some(format!("{} {}", ctx.invoked_command_name(), c)),
|
||||
None => Some(ctx.invoked_command_name().to_string()),
|
||||
};
|
||||
}
|
||||
let extra_text_at_bottom = "";
|
||||
|
||||
let config = HelpConfiguration {
|
||||
show_subcommands: true,
|
||||
show_context_menu_commands: true,
|
||||
ephemeral: true,
|
||||
extra_text_at_bottom,
|
||||
|
||||
..Default::default()
|
||||
};
|
||||
poise::builtins::help(ctx, command.as_deref(), config).await?;
|
||||
Ok(())
|
||||
}
|
|
@ -7,7 +7,7 @@ use crate::commands::voice::voice_utils::autocomplete_channel;
|
|||
|
||||
use super::connect;
|
||||
|
||||
// TODO: search, queue
|
||||
// For list of supported URLs visit https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md
|
||||
#[poise::command(
|
||||
slash_command,
|
||||
description_localized("en-US", "Plays music from supported URL")
|
||||
|
|
|
@ -9,10 +9,12 @@ use crate::utils::utilities::get_local_songs;
|
|||
|
||||
use super::voice_utils::{connect, autocomplete_channel};
|
||||
|
||||
/**
|
||||
* Common commands that are the same for every implementation
|
||||
*/
|
||||
|
||||
/************************************************************
|
||||
* Common commands that are the same for every implementation
|
||||
************************************************************/
|
||||
|
||||
/// Disconnect bot from voice channel
|
||||
#[poise::command(
|
||||
slash_command,
|
||||
description_localized("en-US", "Disconnect from voice channel")
|
||||
|
@ -116,7 +118,7 @@ pub async fn play_local(ctx: Context<'_>,
|
|||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
/// Sends embed with some info about currently playing source
|
||||
#[poise::command(
|
||||
slash_command,
|
||||
description_localized("en-US", "Display currently playing info")
|
||||
|
@ -138,8 +140,6 @@ pub async fn playing(ctx: Context<'_>) -> Result<(), Error> {
|
|||
return Ok(())
|
||||
};
|
||||
|
||||
// println!("here");
|
||||
|
||||
let embed = {
|
||||
let mutex_hashmap = ctx.data().playing_info.lock().await;
|
||||
let Some(playing_info) = mutex_hashmap.get(&guild_id) else {
|
||||
|
|
|
@ -17,6 +17,7 @@ use crate::commands::voice_types::{NumberOfEntries, PlayingInfoType};
|
|||
use crate::types::{Context, Error, ContextExt};
|
||||
use crate::commands::voice::voice_utils::autocomplete_channel;
|
||||
|
||||
/// Plays online radio stream
|
||||
#[poise::command(
|
||||
slash_command,
|
||||
description_localized("en-US", "Plays music from URL source"),
|
||||
|
@ -26,6 +27,7 @@ pub async fn radio(_ctx: Context<'_>) -> Result<(), Error> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Play online radio stream directly from URL or autocompleted string
|
||||
#[poise::command(
|
||||
slash_command,
|
||||
description_localized("en-US", "Plays music from URL source")
|
||||
|
@ -146,8 +148,9 @@ async fn autocomplete_radio(
|
|||
};
|
||||
|
||||
return stations
|
||||
}
|
||||
}
|
||||
|
||||
/// Search online radios (you can use stream URL from output for /play)
|
||||
#[poise::command(
|
||||
slash_command,
|
||||
description_localized("en-US", "Search for a radio")
|
||||
|
|
|
@ -58,7 +58,7 @@ impl EventHandler for Handler {
|
|||
}
|
||||
|
||||
async fn ready(&self, ctx: Context, ready: Ready) {
|
||||
println!("{} v3.3.1 is connected!", ready.user.name);
|
||||
println!("{} v{} is connected!", ready.user.name, option_env!("CARGO_PKG_VERSION").unwrap_or(""));
|
||||
|
||||
#[cfg(feature="RELEASE")] {
|
||||
use utils::debug::hello;
|
||||
|
@ -94,7 +94,8 @@ async fn main() -> anyhow::Result<()> {
|
|||
commands::radio::radio(),
|
||||
commands::general_player::play(),
|
||||
commands::player_common::disconnect(),
|
||||
commands::player_common::playing()
|
||||
commands::player_common::playing(),
|
||||
commands::help(),
|
||||
],
|
||||
prefix_options: poise::PrefixFrameworkOptions {
|
||||
prefix: Some("/".into()),
|
||||
|
|
Loading…
Reference in a new issue