Skip to content

Commit

Permalink
Merge pull request #442 from tktcorporation/feature/271/conflict
Browse files Browse the repository at this point in the history
✨ feedback a bot conflict message
  • Loading branch information
tktcorporation committed May 16, 2024
2 parents 73e1f1a + 0e53ea8 commit 77bb588
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/commands/usecase/services/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use std::fmt;
pub enum Error {
NotInVoiceChannel,
ErrorSourcingFfmpeg,
AlreadyJoined,
JoinError(JoinError),
SerenityError(SerenityError),
TrackError(TrackError),
Expand All @@ -20,6 +21,7 @@ impl fmt::Display for Error {
match self {
Error::NotInVoiceChannel => f.write_str("Not in a voice channel."),
Error::ErrorSourcingFfmpeg => f.write_str("Error sourcing ffmpeg."),
Error::AlreadyJoined => f.write_str("Already joined. I'm busy!"),
Error::JoinError(e) => e.fmt(f),
Error::SerenityError(e) => e.fmt(f),
Error::TrackError(e) => e.fmt(f),
Expand Down
6 changes: 6 additions & 0 deletions src/commands/usecase/services/join/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ pub async fn join(
.await
.expect("Songbird Voice client placed in at initialisation.");

let has_handler = manager.get(guild.id).is_some();
if has_handler {
return Err(Error::AlreadyJoined);
}

// voice settings
let client = config::client::new(crate::infrastructure::GuildPath::new(&guild.id));
client.write(config::Config { speech_options });
Expand Down Expand Up @@ -75,6 +80,7 @@ async fn _clear(handle_lock: &std::sync::Arc<serenity::prelude::Mutex<songbird::

async fn welcome_audio() -> songbird::input::Input {
let file_path = SharedSoundPath::new().welcome_audio_path();
print!("file_path: {:?}", file_path);
ffmpeg(file_path)
.await
.expect("This might fail: handle this error!")
Expand Down

0 comments on commit 77bb588

Please sign in to comment.