Add shell.nix, log stuff
Some checks failed
Rust / check (push) Failing after 3m10s

This commit is contained in:
August 2026-07-22 23:08:58 +00:00
parent d4be6222a1
commit 7b4a83f103
Signed by: shibedrill
SSH Key Fingerprint: SHA256:M0m3JW1s38BgO2t0fG146Yxd9OJ2IOqkvCAsuRHQ6Pw
2 changed files with 24 additions and 4 deletions

21
shell.nix Normal file
View File

@ -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;
'';
}

View File

@ -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