This commit is contained in:
parent
d4be6222a1
commit
7b4a83f103
21
shell.nix
Normal file
21
shell.nix
Normal 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;
|
||||
'';
|
||||
|
||||
}
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user