WIP: hellfire #1

Draft
sad wants to merge 19 commits from hellfire into main
Showing only changes of commit 512a406f43 - Show all commits

View File

@ -67,7 +67,7 @@ fn select_random_file(dir: &str) -> Option<String> {
pub async fn handle_ascii_command<W: AsyncWriteExt + Unpin>( pub async fn handle_ascii_command<W: AsyncWriteExt + Unpin>(
writer: &mut W, writer: &mut W,
config: &Config, // Adjust the path as necessary to match your project structure config: &Config,
command: &str, command: &str,
channel: &str, channel: &str,
) -> Result<(), Box<dyn std::error::Error>> { ) -> Result<(), Box<dyn std::error::Error>> {
@ -143,13 +143,16 @@ async fn handle_specific_file<W: AsyncWriteExt + Unpin>(
channel: &str, channel: &str,
parts: &[&str], parts: &[&str],
) -> Result<(), Box<dyn Error>> { ) -> Result<(), Box<dyn Error>> {
let file_name = if parts.len() >= 3 { println!("{:?}", parts);
parts[2..].join(" ") let file_name = if parts.len() > 2 {
parts[1..].join(" ").replace(' ', "/")
} else { } else {
parts[2].to_string() parts.get(1).unwrap_or(&"").to_string()
}; };
println!("{:?}", file_name);
let file_path = format!("{}/{}.txt", config.ascii_art.clone().unwrap_or_else(|| "ascii_art".to_string()), file_name); let file_path = format!("{}/{}.txt", config.ascii_art.clone().unwrap_or_else(|| "ascii_art".to_string()), file_name);
println!("{:?}", file_path);
send_ansi_art(writer, &file_path, config.pump_delay, channel).await send_ansi_art(writer, &file_path, config.pump_delay, channel).await
} }