Add AI-generated sassy commentary
This commit is contained in:
parent
1342253a76
commit
9242d39f98
4 changed files with 89 additions and 7 deletions
|
@ -1,9 +1,9 @@
|
|||
use anyhow::{Context, Result};
|
||||
use poise::serenity_prelude::{EmbedMessageBuilding, MessageBuilder};
|
||||
use songbird::create_player;
|
||||
use tracing::debug;
|
||||
use tracing::{debug, log::warn};
|
||||
|
||||
use crate::{CommandContext, Error};
|
||||
use crate::{openai, CommandContext, Error};
|
||||
|
||||
#[poise::command(slash_command)]
|
||||
pub async fn join(ctx: CommandContext<'_>) -> Result<(), Error> {
|
||||
|
@ -91,11 +91,22 @@ pub async fn play(
|
|||
.title
|
||||
.clone()
|
||||
.unwrap_or(String::from("This video"));
|
||||
let msg = MessageBuilder::new()
|
||||
.push("Now playing: ")
|
||||
.push_named_link(title, url)
|
||||
.build();
|
||||
ctx.say(msg).await?;
|
||||
|
||||
let mut msg = MessageBuilder::new();
|
||||
|
||||
// Optional sassy commentary!
|
||||
match openai::get_sassy_commentary(&title).await {
|
||||
Ok(commentary) => {
|
||||
msg.push_line(&commentary).push_line("");
|
||||
}
|
||||
Err(e) => {
|
||||
warn!("Failed to get sassy commentary for \"{title}\": {e}");
|
||||
}
|
||||
};
|
||||
|
||||
msg.push_bold("Now playing: ").push_named_link(title, url);
|
||||
|
||||
ctx.say(msg.build()).await?;
|
||||
|
||||
let (audio, track_handle) = create_player(source);
|
||||
let mut currently_playing = ctx.data().currently_playing.lock();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue