chore: cleaned the code a bit
This commit is contained in:
parent
0ff20483c9
commit
d331ba9b52
4 changed files with 6 additions and 29 deletions
|
@ -34,7 +34,3 @@ pub(super) async fn send_with_embed(ctx: Context<'_>, query: &str, title: &str,
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) async fn send(ctx: Context<'_>, msg: &str) -> anyhow::Result<()> {
|
|
||||||
Ok(())
|
|
||||||
}
|
|
|
@ -50,6 +50,7 @@ pub async fn disconnect(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
async fn autocomplete_song(
|
async fn autocomplete_song(
|
||||||
_ctx: Context<'_>,
|
_ctx: Context<'_>,
|
||||||
partial: &str,
|
partial: &str,
|
||||||
|
|
|
@ -8,18 +8,15 @@ use songbird::input::HttpRequest;
|
||||||
|
|
||||||
use super::super::connect;
|
use super::super::connect;
|
||||||
use super::link_or_string;
|
use super::link_or_string;
|
||||||
use super::parse_radio_autocomplete;
|
|
||||||
use super::LinkString;
|
use super::LinkString;
|
||||||
use crate::commands::voice_types::NumberOfEntries;
|
use super::parse_radio_autocomplete;
|
||||||
use crate::commands::voice_types::PlayingInfoType;
|
|
||||||
use crate::types::ContextExt;
|
|
||||||
use crate::types::{Context, Error};
|
|
||||||
use crate::commands::voice::voice_utils::autocomplete_channel;
|
|
||||||
|
|
||||||
use super::radio_utils::paginate_search_stations;
|
use super::radio_utils::paginate_search_stations;
|
||||||
|
|
||||||
use super::super::voice_utils::MAX_ENTRIES;
|
use super::super::voice_utils::MAX_ENTRIES;
|
||||||
|
|
||||||
|
use crate::commands::voice_types::{NumberOfEntries, PlayingInfoType};
|
||||||
|
use crate::types::{Context, Error, ContextExt};
|
||||||
|
use crate::commands::voice::voice_utils::autocomplete_channel;
|
||||||
|
|
||||||
#[poise::command(
|
#[poise::command(
|
||||||
slash_command,
|
slash_command,
|
||||||
description_localized("en-US", "Plays music from URL source"),
|
description_localized("en-US", "Plays music from URL source"),
|
||||||
|
@ -29,9 +26,6 @@ pub async fn radio(_ctx: Context<'_>) -> Result<(), Error> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: deduplicate you use a lot of the same code
|
|
||||||
|
|
||||||
// TODO: autocomplete radio stream URLs
|
|
||||||
#[poise::command(
|
#[poise::command(
|
||||||
slash_command,
|
slash_command,
|
||||||
description_localized("en-US", "Plays music from URL source")
|
description_localized("en-US", "Plays music from URL source")
|
||||||
|
@ -151,22 +145,9 @@ async fn autocomplete_radio(
|
||||||
Err(_) => return vec!["".to_owned()]
|
Err(_) => return vec!["".to_owned()]
|
||||||
};
|
};
|
||||||
|
|
||||||
// dbg!(&stations);
|
|
||||||
|
|
||||||
return stations
|
return stations
|
||||||
// return vec![];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
|
||||||
// autocomplete
|
|
||||||
// search with buttons and list in embed with direct links to stream
|
|
||||||
// embed showing currently playing song
|
|
||||||
|
|
||||||
// use trace::trace;
|
|
||||||
// trace::init_depth_var!();
|
|
||||||
|
|
||||||
// TODO: autocomplete radio stream URLs
|
|
||||||
// #[trace]
|
|
||||||
#[poise::command(
|
#[poise::command(
|
||||||
slash_command,
|
slash_command,
|
||||||
description_localized("en-US", "Search for a radio")
|
description_localized("en-US", "Search for a radio")
|
||||||
|
|
|
@ -118,7 +118,6 @@ pub enum LinkString {
|
||||||
String
|
String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pub fn link_or_string(haystack: &str) -> LinkString {
|
pub fn link_or_string(haystack: &str) -> LinkString {
|
||||||
let Ok(re) = Regex::new(r"^https?://([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$") else {
|
let Ok(re) = Regex::new(r"^https?://([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$") else {
|
||||||
panic!("Wrong regex expression!");
|
panic!("Wrong regex expression!");
|
||||||
|
|
Loading…
Reference in a new issue