Compare commits
No commits in common. "2aa027159e0bc026818fd9038dd7f6026f1bc464" and "9f1fcf3a6c225823a4305495882539d3a7efc85e" have entirely different histories.
2aa027159e
...
9f1fcf3a6c
2167
Cargo.lock
generated
2167
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
10
Cargo.toml
10
Cargo.toml
@ -3,7 +3,7 @@ name = "shibe-bot"
|
|||||||
description = "A Discord bot written in Rust, using Poise."
|
description = "A Discord bot written in Rust, using Poise."
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
version = "1.2.0"
|
version = "1.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
|
|
||||||
@ -23,12 +23,12 @@ serde = { version = "1.0.219", features = ["serde_derive"] }
|
|||||||
serde_json = "1.0.140"
|
serde_json = "1.0.140"
|
||||||
roux = "2.2.13"
|
roux = "2.2.13"
|
||||||
structstruck = "0.5.0"
|
structstruck = "0.5.0"
|
||||||
reqwest = { version = "0.13.1", features = ["json"] }
|
reqwest = { version = "0.12.15", features = ["json"] }
|
||||||
octocrab = { version = "0.49.5", optional = true }
|
octocrab = { version = "0.44.1", optional = true }
|
||||||
tempfile = { version = "3.20.0", optional = true }
|
tempfile = { version = "3.20.0", optional = true }
|
||||||
self-replace = { version = "1.5.0", optional = true }
|
self-replace = { version = "1.5.0", optional = true }
|
||||||
zip = { version = "7.2.0", optional = true }
|
zip = { version = "4.2.0", optional = true }
|
||||||
nix = { version = "0.31.1", features = ["process"], optional = true }
|
nix = { version = "0.30.1", features = ["process"], optional = true }
|
||||||
minreq = { version = "2.14.0", features = ["https"], optional = true }
|
minreq = { version = "2.14.0", features = ["https"], optional = true }
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
# Shibe Bot 1.2.0
|
# Shibe Bot 1.1.0
|
||||||
|
|
||||||
[](https://github.com/shibedrill/shibe-bot/actions/workflows/rust.yml)
|
[](https://github.com/shibedrill/shibe-bot/actions/workflows/rust.yml)
|
||||||
[](LICENSE.txt)
|
[](LICENSE.txt)
|
||||||
|
|||||||
@ -1,8 +1,5 @@
|
|||||||
#[cfg(feature = "self-update")]
|
#[cfg(feature="self-update")]
|
||||||
use {
|
use {std::convert::Infallible, std::os::unix::process::CommandExt, octocrab, std::io::Write, self_replace, zip, minreq};
|
||||||
minreq, octocrab, self_replace, std::convert::Infallible, std::io::Write,
|
|
||||||
std::os::unix::process::CommandExt, zip,
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::Context;
|
use crate::Context;
|
||||||
use crate::Error;
|
use crate::Error;
|
||||||
@ -37,7 +34,7 @@ pub async fn version(ctx: Context<'_>) -> Result<(), Error> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "self-update")]
|
#[cfg(feature="self-update")]
|
||||||
/// Update the bot remotely (requires Github CI)
|
/// Update the bot remotely (requires Github CI)
|
||||||
#[poise::command(slash_command, owners_only, hide_in_help)]
|
#[poise::command(slash_command, owners_only, hide_in_help)]
|
||||||
pub async fn update(
|
pub async fn update(
|
||||||
@ -117,7 +114,7 @@ pub async fn say(
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "self-update")]
|
#[cfg(feature="self-update")]
|
||||||
fn self_update() -> Result<Infallible, Error> {
|
fn self_update() -> Result<Infallible, Error> {
|
||||||
let artifact_url = "https://nightly.link/shibedrill/shibe-bot/workflows/rust/main/artifact.zip";
|
let artifact_url = "https://nightly.link/shibedrill/shibe-bot/workflows/rust/main/artifact.zip";
|
||||||
let tempdir = tempfile::Builder::new().prefix("shibe-bot").tempdir()?;
|
let tempdir = tempfile::Builder::new().prefix("shibe-bot").tempdir()?;
|
||||||
@ -170,11 +167,11 @@ fn self_update() -> Result<Infallible, Error> {
|
|||||||
mod test {
|
mod test {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
#[cfg(feature = "self-update")]
|
#[cfg(feature="self-update")]
|
||||||
use {crate::Error, std::convert::Infallible};
|
use {crate::Error, std::convert::Infallible};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(feature = "self-update")]
|
#[cfg(feature="self-update")]
|
||||||
fn test_self_update() -> Result<Infallible, Error> {
|
fn test_self_update() -> Result<Infallible, Error> {
|
||||||
use crate::command::devel::self_update;
|
use crate::command::devel::self_update;
|
||||||
use pretty_env_logger;
|
use pretty_env_logger;
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
use std::time::Duration;
|
|
||||||
|
|
||||||
use crate::Context;
|
use crate::Context;
|
||||||
use crate::Error;
|
use crate::Error;
|
||||||
|
|
||||||
use poise::serenity_prelude as serenity;
|
use poise::serenity_prelude as serenity;
|
||||||
use rand::seq::IndexedRandom;
|
use rand::seq::IndexedRandom;
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
@ -92,7 +91,7 @@ pub async fn curbstomp(
|
|||||||
&format!("{} made {} eat pavement.", ctx.author(), target)
|
&format!("{} made {} eat pavement.", ctx.author(), target)
|
||||||
};
|
};
|
||||||
ctx.say(response).await?;
|
ctx.say(response).await?;
|
||||||
info!("Executed command `curbstomp` successfully");
|
info!("Executed command `whack` successfully");
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,26 +180,3 @@ pub async fn deer(ctx: Context<'_>) -> Result<(), Error> {
|
|||||||
info!("Executed command `deer` successfully");
|
info!("Executed command `deer` successfully");
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Deer game: look at the deer
|
|
||||||
#[poise::command(slash_command, global_cooldown = 20)]
|
|
||||||
pub async fn game(ctx: Context<'_>) -> Result<(), Error> {
|
|
||||||
ctx.say("Deer game! React to the :deer: first to win.")
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
std::thread::sleep(Duration::from_secs(3));
|
|
||||||
|
|
||||||
let reply = ctx.say(":deer:").await?;
|
|
||||||
let deer_msg = reply.message().await?;
|
|
||||||
let collector = deer_msg.await_reactions(ctx);
|
|
||||||
let collector = collector.timeout(Duration::from_secs(5));
|
|
||||||
|
|
||||||
if let Some(react) = collector.await {
|
|
||||||
let reacting_user = react.user(ctx.http()).await?;
|
|
||||||
ctx.say(format!("{} was first to react! yay!", reacting_user)).await?;
|
|
||||||
} else {
|
|
||||||
ctx.say("Nobody reacted. Game over </3").await?;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|||||||
@ -85,7 +85,7 @@ async fn main() {
|
|||||||
shutdown(),
|
shutdown(),
|
||||||
restart(),
|
restart(),
|
||||||
say(),
|
say(),
|
||||||
#[cfg(feature = "self-update")]
|
#[cfg(feature="self-update")]
|
||||||
update(),
|
update(),
|
||||||
version(),
|
version(),
|
||||||
// Fun
|
// Fun
|
||||||
@ -95,7 +95,6 @@ async fn main() {
|
|||||||
bite(),
|
bite(),
|
||||||
deer(),
|
deer(),
|
||||||
curbstomp(),
|
curbstomp(),
|
||||||
game(),
|
|
||||||
],
|
],
|
||||||
initialize_owners: true,
|
initialize_owners: true,
|
||||||
event_handler: |ctx, event, framework, data| {
|
event_handler: |ctx, event, framework, data| {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user