Compare commits

..

No commits in common. "6955049dc0561f6321c5672a2651e50b3ceacf51" and "c7ebbf4c057181b40aa8d28e6f0885a58683c690" have entirely different histories.

4 changed files with 76 additions and 3 deletions

69
Cargo.lock generated
View File

@ -874,6 +874,16 @@ dependencies = [
"tempfile", "tempfile",
] ]
[[package]]
name = "nu-ansi-term"
version = "0.46.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84"
dependencies = [
"overload",
"winapi",
]
[[package]] [[package]]
name = "num-traits" name = "num-traits"
version = "0.2.17" version = "0.2.17"
@ -961,6 +971,12 @@ dependencies = [
"num-traits", "num-traits",
] ]
[[package]]
name = "overload"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
[[package]] [[package]]
name = "parking_lot" name = "parking_lot"
version = "0.12.1" version = "0.12.1"
@ -1233,6 +1249,8 @@ dependencies = [
"serenity 0.12.0", "serenity 0.12.0",
"tempfile", "tempfile",
"tokio", "tokio",
"tracing",
"tracing-subscriber",
] ]
[[package]] [[package]]
@ -1528,6 +1546,15 @@ dependencies = [
"digest", "digest",
] ]
[[package]]
name = "sharded-slab"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6"
dependencies = [
"lazy_static",
]
[[package]] [[package]]
name = "signal-hook-registry" name = "signal-hook-registry"
version = "1.4.1" version = "1.4.1"
@ -1693,6 +1720,16 @@ dependencies = [
"syn 2.0.39", "syn 2.0.39",
] ]
[[package]]
name = "thread_local"
version = "1.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152"
dependencies = [
"cfg-if",
"once_cell",
]
[[package]] [[package]]
name = "time" name = "time"
version = "0.3.30" version = "0.3.30"
@ -1862,6 +1899,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54"
dependencies = [ dependencies = [
"once_cell", "once_cell",
"valuable",
]
[[package]]
name = "tracing-log"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3"
dependencies = [
"log",
"once_cell",
"tracing-core",
]
[[package]]
name = "tracing-subscriber"
version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b"
dependencies = [
"nu-ansi-term",
"sharded-slab",
"smallvec",
"thread_local",
"tracing-core",
"tracing-log",
] ]
[[package]] [[package]]
@ -2030,6 +2093,12 @@ version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4bf03e0ca70d626ecc4ba6b0763b934b6f2976e8c744088bb3c1d646fbb1ad0" checksum = "f4bf03e0ca70d626ecc4ba6b0763b934b6f2976e8c744088bb3c1d646fbb1ad0"
[[package]]
name = "valuable"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
[[package]] [[package]]
name = "vcpkg" name = "vcpkg"
version = "0.2.15" version = "0.2.15"

View File

@ -12,6 +12,8 @@ serde_json = "1.0.108"
serenity = "0.12.0" serenity = "0.12.0"
tempfile = "3.8.1" tempfile = "3.8.1"
tokio = { version = "1.34.0", features = ["macros", "signal", "rt-multi-thread"] } tokio = { version = "1.34.0", features = ["macros", "signal", "rt-multi-thread"] }
tracing = "0.1.40"
tracing-subscriber = "0.3.18"
[[bin]] [[bin]]
name = "rustbot" name = "rustbot"

View File

@ -26,7 +26,7 @@ pub async fn eval(
{ {
let mut file = std::fs::File::create(&file_path)?; let mut file = std::fs::File::create(&file_path)?;
writeln!(file, "fn main() {{ {} }}", code)?; writeln!(file, "{}", code)?;
} }
// Compile // Compile

View File

@ -2,7 +2,9 @@ use crate::Error;
/// Check if the bot is alive /// Check if the bot is alive
#[poise::command(slash_command)] #[poise::command(slash_command)]
pub async fn ping(ctx: poise::Context<'_, (), Error>) -> Result<(), Error> { pub async fn ping(
ctx.reply(format!("Powong! `{:?}`ms", ctx.ping().await.as_millis())).await?; ctx: poise::Context<'_, (), Error>,
) -> Result<(), Error> {
ctx.reply("Powong!").await?;
Ok(()) Ok(())
} }