From 7b4a83f1035b92008d35d5bcd0a7135795c3b72f Mon Sep 17 00:00:00 2001 From: August Date: Wed, 22 Jul 2026 23:08:58 +0000 Subject: [PATCH] Add shell.nix, log stuff --- shell.nix | 21 +++++++++++++++++++++ src/command/fun.rs | 7 +++---- 2 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 shell.nix diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..c386d0c --- /dev/null +++ b/shell.nix @@ -0,0 +1,21 @@ +let + nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz"; + pkgs = import nixpkgs { config = {}; overlays = []; }; +in + +pkgs.mkShell { + + packages = with pkgs; [ + bash + gcc + rustup + openssl + ]; + + shellHook = '' + echo $TMPDIR; + rustup default nightly; + rustup target add x86_64-unknown-none; + ''; + +} diff --git a/src/command/fun.rs b/src/command/fun.rs index 294847f..25982ad 100644 --- a/src/command/fun.rs +++ b/src/command/fun.rs @@ -163,16 +163,15 @@ pub async fn deer(ctx: Context<'_>) -> Result<(), Error> { let subreddit = Subreddit::new("deer"); let options = FeedOption::new().period(TimePeriod::ThisYear); let hot = subreddit.hot(50, Some(options)).await?; + trace!("Got hot post collection..."); let chosen_post = { let mut rng = rand::rng(); hot.data .children .choose(&mut rng) - .ok_or("Unable to get any hot posts") - .inspect_err(|e| { - error!("Executing command `deer` failed: {}", e); - })? + .ok_or("Unable to get any hot posts")? }; + trace!("Got chosen hot post!"); ctx.say(format!( "https://vxreddit.com{}", &chosen_post.data.permalink