aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Perry <avaglir@gmail.com>2019-03-15 07:54:16 -0400
committerNathan Perry <avaglir@gmail.com>2019-03-15 07:54:16 -0400
commit2685e6028dd775bcd618a3d8d2b22e32730454a3 (patch)
tree4efdcaec04b789fbcddfce4c120e03a30993e61a
parentc05ca6a38c90a83ef8421c153ba8ce840a23cbac (diff)
add reaction whenever playing audio and reaction to message failure
-rw-r--r--src/commands/meme.rs23
-rw-r--r--src/main.rs4
2 files changed, 18 insertions, 9 deletions
diff --git a/src/commands/meme.rs b/src/commands/meme.rs
index 064486d..5dbd831 100644
--- a/src/commands/meme.rs
+++ b/src/commands/meme.rs
@@ -466,16 +466,21 @@ fn send_meme(ctx: &Context, t: &Meme, conn: &PgConnection, msg: &Message) -> Res
// not worrying about it
if let Some(audio) = audio {
let audio = audio?;
- let queue_lock = ctx.data.lock().get::<PlayQueue>().cloned().unwrap();
- let mut play_queue = queue_lock.write().unwrap();
- play_queue.meme_queue.push_back(PlayArgs{
- initiator: msg.author.name.clone(),
- data: ::either::Right(audio.data.clone()),
- sender_channel: msg.channel_id,
- start: None,
- end: None,
- });
+ {
+ let queue_lock = ctx.data.lock().get::<PlayQueue>().cloned().unwrap();
+ let mut play_queue = queue_lock.write().unwrap();
+
+ play_queue.meme_queue.push_back(PlayArgs{
+ initiator: msg.author.name.clone(),
+ data: ::either::Right(audio.data.clone()),
+ sender_channel: msg.channel_id,
+ start: None,
+ end: None,
+ });
+ }
+
+ msg.react("📣")?;
}
Ok(())
diff --git a/src/main.rs b/src/main.rs
index 1577c89..177f726 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -136,6 +136,10 @@ fn run() -> Result<()> {
trace!("command '{}' completed successfully", cmd);
},
Err(e) => {
+ if let Err(e) = msg.react("❌") {
+ error!("reacting to failed message: {}", e);
+ }
+
if let Err(e) = crate::commands::send(msg.channel_id, "BANIC", msg.tts) {
error!("sending BANIC: {}", e);
}