diff --git a/Cargo.lock b/Cargo.lock index 57b0eb4..5ed11b1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -931,6 +931,7 @@ dependencies = [ "log", "manifold", "poise", + "rand 0.9.1", "tokio", ] @@ -1964,10 +1965,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha", + "rand_chacha 0.3.1", "rand_core 0.6.4", ] +[[package]] +name = "rand" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.3", +] + [[package]] name = "rand_chacha" version = "0.3.1" @@ -1978,6 +1989,16 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", +] + [[package]] name = "rand_core" version = "0.3.1" @@ -2002,6 +2023,15 @@ dependencies = [ "getrandom 0.2.16", ] +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.2", +] + [[package]] name = "rdrand" version = "0.4.0" diff --git a/Cargo.toml b/Cargo.toml index a76513c..06b8b49 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,4 +15,6 @@ log = "0.4.20" manifold = { git = "https://code.orbiter-radio.uk/discord/manifold.git" } # manifold = { path = "/home/xyon/Workspace/manifold/" } poise = { version = "0.5.*", features = [ "cache" ] } +rand = { version = "0.9.1", features = ["std_rng"] } tokio = { version = "1.16.1", features = ["sync", "macros", "rt-multi-thread"] } + diff --git a/config/development.hal.json b/config/development.hal.json index 8377d31..8910657 100644 --- a/config/development.hal.json +++ b/config/development.hal.json @@ -4,12 +4,12 @@ "database": { "host": "127.0.0.1", "user": "badgey_development", - "pass": "", + "pass": "7ZhUVzr7sxcPEEDMdxfEryW4NTZX5C2ufzZd3r2s25xULgH7FWXJVts", "database_name": "hal_development", "port": 5432 }, "channels": { - "log": "1367986872084860959" + "log": "648260641626390528" }, "responses_file_path": "txt/responses.hal", "services": { diff --git a/src/hal/commands/fun.rs b/src/hal/commands/fun.rs new file mode 100644 index 0000000..4efcd25 --- /dev/null +++ b/src/hal/commands/fun.rs @@ -0,0 +1,37 @@ +use manifold::error::{ManifoldError, ManifoldResult}; +use manifold::{ManifoldContext, ManifoldData}; +use rand::rngs::StdRng; +use rand::SeedableRng; +use rand::seq::IndexedRandom; + +#[poise::command(slash_command, prefix_command)] +async fn bikeshed(ctx: ManifoldContext<'_>) -> ManifoldResult<()> { + + let mut rng = StdRng::from_os_rng(); + + const BIKESHED_STRENGTH: &[&str] = &["should", "could", "must", "would best", "can", "will"]; + const BIKESHED_OPTIMISM: &[&str] = &["ideally", "optimally", "only", "surely", "absolutely", "always", "definitely", "perhaps", "optionally", ""]; + const BIKESHED_COLOURS: &[&str] = &["alabaster", "almond", "amaranth", "amber", "amethyst", "apricot", "aqua", "aquamarine", "asparagus", "azure", "baby blue", "baby pink", "baby powder", "beige", "bisque", "bistre", "black", "blood red", "blue", "[THIS COLOUR REMOVED DUE TO LICENSING CONSTRAINTS FROM PANTONE]", "brick red", "british racing green", "bronze", "brown", "buff", "burgundy", "burnt orange", "burnt sienna", "burnt umber", "byzantium", "cadet", "cadmium yellow", "camel", "canary yellow", "cardinal", "celadon", "celeste", "cerulean", "champagne", "sparkling off-white from outside the champagne region of France", "charcoal", "chartreuse", "chestnut", "chocolate", "citrine", "citron", "claret", "cobalt blue", "coconut", "coffee", "cool grey", "copper", "coral", "cornflower", "crimson", "cyan", "dandelion", "dirt", "ebony", "eggshell", "electric blue", "emerald", "eucalyptus", "fandango", "fern green", "firebrick", "flame", "flax", "flirt", "forest green", "fuschia", "garnet", "gold", "golden brown", "goldenrod", "green", "green (but a shade of green everyone will call blue)", "gunmetal", "harlequin", "hot pink", "indigo", "ivory", "jade", "jasmine", "jet", "lapis lazuli", "lava", "lavender", "lemon", "liver", "magenta", "mauve", "mint", "ochre", "orchid", "oxblood", "periwinkle", "pewter", "pine", "pineapple", "pink", "pistachio", "plum", "powder blue", "prune", "puce", "pumpkin", "purple", "quartz", "raspberry", "red", "rose", "royal blue", "rum", "rust", "saffron", "sage", "salmon", "sand", "sapphire", "scarlet", "sea blue", "sea green", "sepia", "shamrock green", "shocking pink", "silver", "sky blue", "slate grey", "steel blue", "straw", "strawberry red", "sunset orange", "tan", "tangerine", "taupe", "teal", "terracotta", "titanium", "topaz", "turqoise", "ultramarine", "umber", "vanilla", "vantablack (without paying anish kapoor any money)", "vermillion", "vine green", "violet", "viridian", "wenge", "wheat", "white", "wisteria", "xanadu", "xanthic", "yellow"]; + const BIKESHED_COLOURTYPES: &[&str] = &["flat", "matte", "velvet", "eggshell", "low luster", "pearl", "satin", "semi-gloss", "gloss"]; + const BIKESHED_COLOURSCHEMES: &[&str] = &["colour blocks", "geometric shapes", "hexagons (the bestagons)", "horizontal stripes", "vertical stripes", "diagonal stripes", "ombre", "chevrons", "leopard print", "leaf print", "polka dots", "jackson pollock splatter"]; + const BIKESHED_ADJECTIVES: &[&str] = &["spectacular", "horrific", "garish", "luminous", "neon", "monstrous", "offensive", "incredible", "900 metre tall", "despicable", "vomit-inducing", "inappropriate", "bohemian", "artistic", "restrained", "minimalistic", "cozy", "elegant", "harmonious", "luxurious", "opulent", "stylish", "traditional", "relaxing", "stressful", "rustic", "insane"]; + const BIKESHED_VERBS: &[&str] = &["painted", "smeared", "daubed", "plastered", "stained", "coated", "tainted", "brushed", "emblazoned", "varnished", "frescoed", "covered", "shaded", "dyed", "glossed", "infused", "adorned", "lacquered"]; + + let response = format!("The bikeshed {strength} {optimism} be {verb} with {adjective} {colourtype} {colour} {colourscheme}", + strength = BIKESHED_STRENGTH.choose(&mut rng).unwrap_or(&"may"), + optimism = BIKESHED_OPTIMISM.choose(&mut rng).unwrap_or(&"hopefully"), + verb = BIKESHED_VERBS.choose(&mut rng).unwrap_or(&"decorated"), + adjective = BIKESHED_ADJECTIVES.choose(&mut rng).unwrap_or(&"wild"), + colourtype = BIKESHED_COLOURTYPES.choose(&mut rng).unwrap_or(&"pastel"), + colour = BIKESHED_COLOURS.choose(&mut rng).unwrap_or(&"beige"), + colourscheme = BIKESHED_COLOURSCHEMES.choose(&mut rng).unwrap_or(&"block colours"), + ); + + ctx.say(response).await?; + + Ok(()) +} + +pub fn commands() -> [poise::Command; 1] { + [bikeshed()] +} \ No newline at end of file diff --git a/src/hal/commands/mod.rs b/src/hal/commands/mod.rs index 555e169..15ae40a 100644 --- a/src/hal/commands/mod.rs +++ b/src/hal/commands/mod.rs @@ -1,9 +1,14 @@ +mod utility; +mod fun; + use manifold::{ManifoldData}; use manifold::error::{ManifoldError}; use poise::Command; pub fn collect_commands() -> Vec> { commands().into_iter() + .chain(utility::commands()) + .chain(fun::commands()) .collect() } diff --git a/src/hal/commands/utility.rs b/src/hal/commands/utility.rs new file mode 100644 index 0000000..f579213 --- /dev/null +++ b/src/hal/commands/utility.rs @@ -0,0 +1,24 @@ +use manifold::error::{ManifoldError, ManifoldResult}; +use manifold::{ManifoldContext, ManifoldData}; +use poise::serenity_prelude::RoleId; +use poise::ChoiceParameter; + +#[derive(ChoiceParameter)] +enum ReminderCadence { + Daily, + Weekly, + Monthly, + Yearly, + Weekdaily, + Fortnightly, + FourWeekly, +} + +#[poise::command(slash_command, prefix_command, aliases("r"))] +async fn reminder(ctx: ManifoldContext<'_>, target: RoleId, cadence: ReminderCadence, tod: u8) -> ManifoldResult<()> { + Ok(()) +} + +pub fn commands() -> [poise::Command; 1] { + [reminder()] +}