1 Commits
0.5.1 ... 0.6.0

Author SHA1 Message Date
4e92771f8f minor refractors, uptime removed 2024-02-18 19:28:46 +01:00
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 seek::seek;
pub use shuffle::shuffle; pub use shuffle::shuffle;
pub use skip::skip; pub use skip::skip;
pub use soundboard::soundboard;
pub use stop::stop; pub use stop::stop;
pub use volume::volume; pub use volume::volume;

View File

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

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 qr;
pub mod register; pub mod register;
pub mod taf; pub mod taf;
pub mod uptime; // pub mod uptime;
pub mod verse; pub mod verse;
pub mod weather; pub mod weather;
@@ -26,6 +26,6 @@ pub use posix::posix;
pub use qr::qr; pub use qr::qr;
pub use register::register; pub use register::register;
pub use taf::taf; pub use taf::taf;
pub use uptime::uptime; // pub use uptime::uptime;
pub use verse::verse; pub use verse::verse;
pub use weather::weather; pub use weather::weather;

View File

@@ -2,11 +2,34 @@ use poise::CreateReply;
use crate::{commands::embeds::embed, Context, Error}; 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 /// Checks how long the bot has been running
#[poise::command(prefix_command, slash_command, category = "Tools")] #[poise::command(prefix_command, slash_command, category = "Tools")]
pub async fn uptime(ctx: Context<'_>) -> Result<(), Error> { pub async fn uptime(ctx: Context<'_>) -> Result<(), Error> {
ctx.send(CreateReply::default().embed(embed(ctx, "", "", "").await.unwrap())) let uptime = PROCESS_UPTIME;
.await?; 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(()) Ok(())
} }

View File

@@ -55,9 +55,10 @@ async fn main() {
music::seek(), music::seek(),
music::shuffle(), music::shuffle(),
music::skip(), music::skip(),
music::soundboard(),
music::stop(), music::stop(),
music::volume(), music::volume(),
music::soundboard::effect(),
music::soundboard::stream(),
tools::ai(), tools::ai(),
tools::dice(), tools::dice(),
tools::dictionary(), tools::dictionary(),
@@ -70,7 +71,7 @@ async fn main() {
tools::qr(), tools::qr(),
tools::register(), tools::register(),
tools::taf(), tools::taf(),
tools::uptime(), // tools::uptime(),
tools::verse(), tools::verse(),
tools::weather(), tools::weather(),
]; ];