aboutsummaryrefslogtreecommitdiff
path: root/src/commands/sound_levels.rs
diff options
context:
space:
mode:
authorNathan Perry <avaglir@gmail.com>2019-03-04 12:52:03 -0500
committerNathan Perry <avaglir@gmail.com>2019-03-04 12:52:03 -0500
commitfc1fcbad504617053d6e8cb63b5eba2f051ec665 (patch)
tree79bbb57463dd0e187d17416a88cab68500a58f15 /src/commands/sound_levels.rs
parent47be7de23836aa97a9283c73bdf90d91c5f45485 (diff)
improve logging and user feedback for commands
Diffstat (limited to 'src/commands/sound_levels.rs')
-rw-r--r--src/commands/sound_levels.rs17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/commands/sound_levels.rs b/src/commands/sound_levels.rs
index fee3e37..60803a3 100644
--- a/src/commands/sound_levels.rs
+++ b/src/commands/sound_levels.rs
@@ -6,9 +6,7 @@ use serenity::{
use crate::{
audio::{PlayQueue, VoiceManager},
- commands::{
- send,
- },
+ commands::send,
Result,
TARGET_GUILD_ID,
};
@@ -58,13 +56,21 @@ pub fn volume(ctx: &mut Context, msg: &Message, mut args: Args) -> Result<()> {
(play_queue.volume / DEFAULT_VOLUME * 100.0) as usize
};
+ trace!("reporting volume {}", vol);
+
return send(msg.channel_id, &format!("volume: {}%", vol), msg.tts);
}
let vol: usize = match args.single::<f32>() {
- Ok(vol) if vol.is_nan() => return send(msg.channel_id, "you're a fuck", msg.tts),
+ Ok(vol) if vol.is_nan() => {
+ warn!("reporting NaN volume");
+ return send(msg.channel_id, "you're a fuck", msg.tts);
+ },
Ok(vol) => vol as usize,
- Err(_) => return send(msg.channel_id, "???????", msg.tts),
+ Err(e) => {
+ error!("parsing volume arg: {}", e);
+ return send(msg.channel_id, "???????", msg.tts)
+ },
};
let mut vol: f32 = (vol as f32)/100.0; // force aliasing to reasonable values
@@ -83,6 +89,7 @@ pub fn volume(ctx: &mut Context, msg: &Message, mut args: Args) -> Result<()> {
{
let mut play_queue = queue_lock.write().unwrap();
play_queue.volume = vol * DEFAULT_VOLUME;
+ info!("volume updated to {}", vol);
}
send(msg.channel_id, format!("volume adjusted{}", adjusted_text), msg.tts)?;