Hello there I'm back
This commit is contained in:
17 files changed
+614
-899
No files matched your search
@@ -280,35 +280,24 @@ pub fn component(ctx: Context, mut interaction: MessageComponentInteraction) ->
|
||||
};
|
||||
|
||||
// Send the desired command to the session
|
||||
let success = match interaction.data.custom_id.as_str() {
|
||||
match interaction.data.custom_id.as_str() {
|
||||
"playing::btn_pause_play" => {
|
||||
if pbi.is_playing {
|
||||
session.pause().await.is_ok()
|
||||
session.pause().await
|
||||
} else {
|
||||
session.resume().await.is_ok()
|
||||
session.resume().await
|
||||
}
|
||||
}
|
||||
|
||||
"playing::btn_previous_track" => session.previous().await.is_ok(),
|
||||
"playing::btn_previous_track" => session.previous().await,
|
||||
|
||||
"playing::btn_next_track" => session.next().await.is_ok(),
|
||||
"playing::btn_next_track" => session.next().await,
|
||||
|
||||
_ => {
|
||||
error!("Unknown custom_id: {}", interaction.data.custom_id);
|
||||
false
|
||||
}
|
||||
};
|
||||
|
||||
if !success {
|
||||
error_message(
|
||||
"Cannot change playback state",
|
||||
"An error occurred while trying to change the playback state",
|
||||
)
|
||||
.await;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
interaction.defer(&ctx.http).await.ok();
|
||||
tokio::time::sleep(Duration::from_millis(
|
||||
if interaction.data.custom_id == "playing::btn_pause_play" {
|
||||
|
||||
@@ -15,9 +15,6 @@ use serenity::{
|
||||
prelude::{Context, EventHandler},
|
||||
};
|
||||
|
||||
#[cfg(feature = "metrics")]
|
||||
use crate::metrics::MetricsManager;
|
||||
|
||||
// If the GUILD_ID environment variable is set, only allow commands from that guild
|
||||
macro_rules! enforce_guild {
|
||||
($interaction:ident) => {
|
||||
@@ -99,12 +96,6 @@ impl Handler {
|
||||
let data = ctx.data.read().await;
|
||||
let command_manager = data.get::<CommandManager>().expect("to contain a value");
|
||||
|
||||
#[cfg(feature = "metrics")]
|
||||
{
|
||||
let metrics = data.get::<MetricsManager>().expect("to contain a value");
|
||||
metrics.command_exec(&command.data.name);
|
||||
}
|
||||
|
||||
command_manager.execute_command(&ctx, command).await;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user