Compare commits

..

2 commits

Author SHA1 Message Date
502517cfcb Ignore .mp3 files 2023-11-07 23:47:50 -08:00
9233d19a49 Better error handling 2023-11-07 23:47:26 -08:00
2 changed files with 12 additions and 3 deletions

3
.gitignore vendored
View file

@ -1,4 +1,5 @@
/target
.direnv
result
.env
.env
*.mp3

View file

@ -47,8 +47,16 @@ async fn event_handler(
new_message.react(&ctx.http, '💤').await?;
} else {
println!("{}: {}", new_message.author.name, new_message.content);
new_message.react(&ctx.http, '✅').await?;
NARRATOR.speak(&format!("{} says {}", new_message.author.name, RE.replace_all(&new_message.content[PREFIX.len()..], "$1"))).unwrap();
match NARRATOR.speak(&format!("{} says {}", new_message.author.name, RE.replace_all(&new_message.content[PREFIX.len()..], "$1"))) {
Ok(_) => {
new_message.react(&ctx.http, '✅').await?;
},
Err(err) => {
println!("{err}");
new_message.react(&ctx.http, '❌').await?;
new_message.reply(&ctx.http, "TTS failed, message might be too long").await?;
},
}
}
}
}