Changed name
This commit is contained in:
parent
1e775d8197
commit
49f9b732dd
28
Cargo.lock
generated
28
Cargo.lock
generated
@ -303,20 +303,6 @@ version = "2.5.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5"
|
checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "deerbot-rebleated"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"dotenv",
|
|
||||||
"log",
|
|
||||||
"poise",
|
|
||||||
"pretty_env_logger",
|
|
||||||
"rand",
|
|
||||||
"serde",
|
|
||||||
"serde_json",
|
|
||||||
"tokio",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "deranged"
|
name = "deranged"
|
||||||
version = "0.3.11"
|
version = "0.3.11"
|
||||||
@ -1342,6 +1328,20 @@ dependencies = [
|
|||||||
"digest",
|
"digest",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "shibe-bot"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"dotenv",
|
||||||
|
"log",
|
||||||
|
"poise",
|
||||||
|
"pretty_env_logger",
|
||||||
|
"rand",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"tokio",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "skeptic"
|
name = "skeptic"
|
||||||
version = "0.13.7"
|
version = "0.13.7"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "deerbot-rebleated"
|
name = "shibe-bot"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
|
@ -4,77 +4,3 @@ use rand::Rng;
|
|||||||
use crate::Context;
|
use crate::Context;
|
||||||
use crate::Error;
|
use crate::Error;
|
||||||
|
|
||||||
/// MAKE HER BLEAT
|
|
||||||
#[poise::command(slash_command)]
|
|
||||||
pub async fn bleat(ctx: Context<'_>) -> Result<(), Error> {
|
|
||||||
#[allow(unused_variables)]
|
|
||||||
let sounds: Vec<&str> = [
|
|
||||||
"rah", "grr", "bah", "bleat", "yippee", "woohoo", "huh", "wha", "buh", "whuh", "oh",
|
|
||||||
"yeag", "yeab", "yeas", "mweee", "mweh", "bwah",
|
|
||||||
]
|
|
||||||
.to_vec();
|
|
||||||
|
|
||||||
#[allow(unused_variables)]
|
|
||||||
let faces: Vec<&str> = vec!["xp", "x3", ":3", ":3c", ";3", ";3c", "=p"];
|
|
||||||
|
|
||||||
#[allow(unused_variables)]
|
|
||||||
let exclamation: Vec<&str> = vec!["!", "1", "?", "-", ",", "."];
|
|
||||||
|
|
||||||
fn modify_sound(input: &str) -> String {
|
|
||||||
// Create an RNG
|
|
||||||
let mut rng = rand::thread_rng();
|
|
||||||
|
|
||||||
// Possibly uppercase or lowercase
|
|
||||||
let output = match rng.gen_bool(0.5) {
|
|
||||||
true => input.to_ascii_uppercase(),
|
|
||||||
false => input.to_ascii_uppercase(),
|
|
||||||
};
|
|
||||||
|
|
||||||
let n = rng.gen_range(0..3);
|
|
||||||
let mut new_string = "*".repeat(n);
|
|
||||||
new_string.push_str(&output);
|
|
||||||
new_string.push_str(&"*".repeat(n));
|
|
||||||
|
|
||||||
// Return modified string
|
|
||||||
new_string
|
|
||||||
}
|
|
||||||
|
|
||||||
let sound: String = match rand::thread_rng().gen_range(0..3) {
|
|
||||||
0..=10 => {
|
|
||||||
let count = rand::thread_rng().gen_range(1..3);
|
|
||||||
let mut new_sound: String = String::new();
|
|
||||||
for _i in 0..count {
|
|
||||||
new_sound.push_str(&modify_sound(
|
|
||||||
sounds.choose(&mut rand::thread_rng()).unwrap(),
|
|
||||||
));
|
|
||||||
new_sound.push(' ');
|
|
||||||
}
|
|
||||||
new_sound
|
|
||||||
}
|
|
||||||
11 => {
|
|
||||||
format!(
|
|
||||||
"am so {}ing awesome",
|
|
||||||
modify_sound(sounds.choose(&mut rand::thread_rng()).unwrap())
|
|
||||||
)
|
|
||||||
}
|
|
||||||
12 => {
|
|
||||||
format!(
|
|
||||||
"feel so {} like a {} machine",
|
|
||||||
modify_sound(sounds.choose(&mut rand::thread_rng()).unwrap()),
|
|
||||||
modify_sound(sounds.choose(&mut rand::thread_rng()).unwrap())
|
|
||||||
)
|
|
||||||
}
|
|
||||||
13 => {
|
|
||||||
format!(
|
|
||||||
"do it {}",
|
|
||||||
modify_sound(sounds.choose(&mut rand::thread_rng()).unwrap())
|
|
||||||
)
|
|
||||||
}
|
|
||||||
_ => unreachable!(),
|
|
||||||
};
|
|
||||||
|
|
||||||
ctx.say(sound) // This unwrap will never return None. We promise this slice will always be non empty.
|
|
||||||
.await?;
|
|
||||||
info!("Executed command `bleat` successfully");
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
@ -55,7 +55,7 @@ async fn main() {
|
|||||||
// Set up framework
|
// Set up framework
|
||||||
let framework = poise::Framework::builder()
|
let framework = poise::Framework::builder()
|
||||||
.options(poise::FrameworkOptions {
|
.options(poise::FrameworkOptions {
|
||||||
commands: vec![age(), info(), bleat(), add_channel(), list_channels()],
|
commands: vec![age(), info(), add_channel(), list_channels()],
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.setup(|ctx, _ready, framework| {
|
.setup(|ctx, _ready, framework| {
|
||||||
|
Loading…
Reference in New Issue
Block a user