minor refractors, uptime removed

This commit is contained in:
2024-02-18 19:28:46 +01:00
parent 8a947926f7
commit 4e92771f8f
8 changed files with 56 additions and 17 deletions

View File

@@ -28,6 +28,5 @@ pub use resume::resume;
pub use seek::seek;
pub use shuffle::shuffle;
pub use skip::skip;
pub use soundboard::soundboard;
pub use stop::stop;
pub use volume::volume;

View File

@@ -1,11 +1,5 @@
use crate::{commands::embeds::embed, Context, Error};
use poise::CreateReply;
pub mod effect;
pub mod stream;
/// A better soundboard
#[poise::command(prefix_command, slash_command, category = "Music")]
pub async fn soundboard(ctx: Context<'_>) -> Result<(), Error> {
ctx.send(CreateReply::default().embed(embed(ctx, "", "", "").await.unwrap()))
.await?;
Ok(())
}
pub use effect::effect;
pub use stream::stream;

View File

@@ -0,0 +1,11 @@
use crate::{commands::embeds::embed, Context, Error};
use poise::CreateReply;
/// Plays one of available audio effects
#[poise::command(prefix_command, slash_command, category = "Music")]
pub async fn effect(ctx: Context<'_>) -> Result<(), Error> {
ctx.send(CreateReply::default().embed(embed(ctx, "Playing an effect", "", "").await.unwrap()))
.await?;
Ok(())
}

View File

@@ -0,0 +1,11 @@
use crate::{commands::embeds::embed, Context, Error};
use poise::CreateReply;
/// Hijacks current audio output and plays selected audio
#[poise::command(prefix_command, slash_command, aliases("override"), category = "Music")]
pub async fn stream(ctx: Context<'_>) -> Result<(), Error> {
ctx.send(CreateReply::default().embed(embed(ctx, "Playing audio", "", "").await.unwrap()))
.await?;
Ok(())
}

View File

@@ -10,7 +10,7 @@ pub mod posix;
pub mod qr;
pub mod register;
pub mod taf;
pub mod uptime;
// pub mod uptime;
pub mod verse;
pub mod weather;
@@ -26,6 +26,6 @@ pub use posix::posix;
pub use qr::qr;
pub use register::register;
pub use taf::taf;
pub use uptime::uptime;
// pub use uptime::uptime;
pub use verse::verse;
pub use weather::weather;

View File

@@ -2,11 +2,34 @@ use poise::CreateReply;
use crate::{commands::embeds::embed, Context, Error};
// Currently unable to get information on how long the thread was running.
const PROCESS_UPTIME: i64 = 1000;
/// Checks how long the bot has been running
#[poise::command(prefix_command, slash_command, category = "Tools")]
pub async fn uptime(ctx: Context<'_>) -> Result<(), Error> {
ctx.send(CreateReply::default().embed(embed(ctx, "", "", "").await.unwrap()))
.await?;
let uptime = PROCESS_UPTIME;
let days = uptime / (24 * 60 * 60);
let hours = (uptime % (24 * 60 * 60)) / 3600;
let minutes = (uptime % 60 * 60) / 60;
let seconds = uptime % 60;
ctx.send(
CreateReply::default().embed(
embed(
ctx,
"I have been up and awake for",
&format!("{} seconds", uptime),
&format!(
"{} days, {} hours, {} minutes and {} seconds",
days, hours, minutes, seconds
),
)
.await
.unwrap(),
),
)
.await?;
Ok(())
}