Bring client up to date.
This commit is contained in:
parent
60adc2a7b3
commit
5d3a742454
6
deps.edn
6
deps.edn
|
@ -2,13 +2,13 @@
|
|||
:paths ["src"]
|
||||
:deps {
|
||||
org.clojure/clojure { :mvn/version "1.11.1" }
|
||||
org.clojure/core.async { :mvn/version "1.5.648" }
|
||||
org.clojure/core.async { :mvn/version "1.6.673" }
|
||||
|
||||
net.bis5.mattermost4j/mattermost4j-core { :mvn/version "0.24.0" }
|
||||
net.bis5.mattermost4j/mattermost4j-core { :mvn/version "0.25.0" }
|
||||
|
||||
org.fudo/fudo-clojure {
|
||||
:git/url "https://git.fudo.org/fudo-public/fudo-clojure.git"
|
||||
:sha "c6a1ebef2e5b64d432a46ac48639c674e62b7cee"
|
||||
:sha "5fd28094e18281ff409050fb1b0dda94b76671ed"
|
||||
}
|
||||
}
|
||||
:aliases {
|
||||
|
|
137
flake.lock
137
flake.lock
|
@ -3,17 +3,18 @@
|
|||
"clj-nix": {
|
||||
"inputs": {
|
||||
"devshell": "devshell",
|
||||
"flake-utils": "flake-utils_2",
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": [
|
||||
"helpers",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1659540150,
|
||||
"narHash": "sha256-FEA04aRQ5R6yZKbVWu1wvYR7ftzMcDK17LfQU7eUISE=",
|
||||
"lastModified": 1677342613,
|
||||
"narHash": "sha256-BqhKj7jQahSVThEwLHt164kJHGx9LXzBARFZaFNLPW8=",
|
||||
"owner": "jlesquembre",
|
||||
"repo": "clj-nix",
|
||||
"rev": "d6f4871b43018c9f2027a109b09c7a093c68177c",
|
||||
"rev": "7d9e244ea96988524ba3bd6c2bbafdf0a5340b96",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -22,10 +23,35 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"clj2nix": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"utils": "utils"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1673786922,
|
||||
"narHash": "sha256-MrwSNEXpq20/AvMxW49MRbuqf8C2M4Vei3jtZeXYjJk=",
|
||||
"owner": "hlolli",
|
||||
"repo": "clj2nix",
|
||||
"rev": "04b0dfbfc69c6316b8613d061e3fe4619d79cd9f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hlolli",
|
||||
"repo": "clj2nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"devshell": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"flake-utils": [
|
||||
"helpers",
|
||||
"clj-nix",
|
||||
"flake-utils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"helpers",
|
||||
"clj-nix",
|
||||
"nixpkgs"
|
||||
]
|
||||
|
@ -44,22 +70,23 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1642700792,
|
||||
"narHash": "sha256-XqHrk7hFb+zBvRg6Ghl+AZDq03ov6OshJLiSWOoX5es=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "846b2ae0fc4cc943637d3d1def4454213e203cba",
|
||||
"lastModified": 1668681692,
|
||||
"narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "009399224d5e398d03b22badca40a37ac85412a1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1656928814,
|
||||
"narHash": "sha256-RIFfgBuKz6Hp89yRr7+NR5tzIAbn52h8vT6vXkYjZoM=",
|
||||
|
@ -74,29 +101,97 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"helpers": {
|
||||
"inputs": {
|
||||
"clj-nix": "clj-nix",
|
||||
"clj2nix": "clj2nix",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"utils": "utils_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1677792046,
|
||||
"narHash": "sha256-GU7czTodGN+6ijrz5MuREJMyfPo9aDsXRjaZA+nl+ys=",
|
||||
"ref": "refs/heads/master",
|
||||
"rev": "d54fa928c37e7f260c2b99bc733634347e83d9fd",
|
||||
"revCount": 32,
|
||||
"type": "git",
|
||||
"url": "https://git.fudo.org/fudo-public/nix-helpers.git"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "https://git.fudo.org/fudo-public/nix-helpers.git"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1659446231,
|
||||
"narHash": "sha256-hekabNdTdgR/iLsgce5TGWmfIDZ86qjPhxDg/8TlzhE=",
|
||||
"lastModified": 1673785507,
|
||||
"narHash": "sha256-EPUT8yVdvJhhjhbgnFWXXd4IUPKSOmww2+z4AmOdyPI=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "eabc38219184cc3e04a974fe31857d8e0eac098d",
|
||||
"rev": "d06d765eeac716d8f1ca80f0935fd6fc951816ad",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1679139072,
|
||||
"narHash": "sha256-Gtw2Yj8DfETie3u7iHv1y5Wt+plGRmp6nTQ0EEfaPho=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "08ef7dc8334521605a5c8b7086cc248e74ee338b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-21.11",
|
||||
"ref": "nixos-22.11",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"clj-nix": "clj-nix",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"utils": "utils"
|
||||
"helpers": "helpers",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"utils": "utils_3"
|
||||
}
|
||||
},
|
||||
"utils": {
|
||||
"locked": {
|
||||
"lastModified": 1667395993,
|
||||
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"utils_2": {
|
||||
"locked": {
|
||||
"lastModified": 1676283394,
|
||||
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"utils_3": {
|
||||
"locked": {
|
||||
"lastModified": 1659877975,
|
||||
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
||||
|
|
36
flake.nix
36
flake.nix
|
@ -2,35 +2,33 @@
|
|||
description = "BeBot Mattermost chatbot Clojure library.";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "nixpkgs/nixos-21.11";
|
||||
nixpkgs.url = "nixpkgs/nixos-22.11";
|
||||
utils.url = "github:numtide/flake-utils";
|
||||
clj-nix = {
|
||||
url = "github:jlesquembre/clj-nix";
|
||||
helpers = {
|
||||
url = "git+https://git.fudo.org/fudo-public/nix-helpers.git";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, utils, clj-nix, ... }:
|
||||
outputs = { self, nixpkgs, utils, helpers, ... }:
|
||||
utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages."${system}";
|
||||
cljpkgs = clj-nix.packages."${system}";
|
||||
update-deps = pkgs.writeShellScriptBin "update-deps.sh" ''
|
||||
${clj-nix.packages."${system}".deps-lock}/bin/deps-lock
|
||||
'';
|
||||
let pkgs = nixpkgs.legacyPackages."${system}";
|
||||
in {
|
||||
packages = {
|
||||
bebot = cljpkgs.mkCljBin {
|
||||
projectSrc = ./.;
|
||||
packages = rec {
|
||||
default = bebot;
|
||||
bebot = helpers.packages."${system}".mkClojureLib {
|
||||
name = "org.fudo/bebot";
|
||||
main-ns = "bebot.core";
|
||||
jdkRunner = pkgs.jdk17_headless;
|
||||
primaryNamespace = "bebot.core";
|
||||
src = ./.;
|
||||
};
|
||||
};
|
||||
|
||||
packages.default = self.packages."${system}".bebot;
|
||||
|
||||
devShells.default =
|
||||
pkgs.mkShell { buildInputs = with pkgs; [ clojure update-deps ]; };
|
||||
devShells = rec {
|
||||
default = updateDeps;
|
||||
updateDeps = pkgs.mkShell {
|
||||
buildInputs = with helpers.packages."${system}";
|
||||
[ updateClojureDeps ];
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
|
@ -4,10 +4,8 @@
|
|||
[bebot.api.channel :as chan]
|
||||
[fudo-clojure.result :refer [let-result exception-failure success failure map-success dispatch-result]]
|
||||
[clojure.core.async :as async :refer [go-loop chan timeout >! <!]])
|
||||
(:import (net.bis5.mattermost.client4 ApiResponse
|
||||
MattermostClient)
|
||||
net.bis5.mattermost.model.ChannelView)
|
||||
(:use bebot.api.client))
|
||||
(:import net.bis5.mattermost.client4.MattermostClient
|
||||
net.bis5.mattermost.model.ChannelView))
|
||||
|
||||
(defn- to-result [resp]
|
||||
(if (.hasError resp)
|
||||
|
@ -27,24 +25,26 @@
|
|||
(defn- to-millis [instant]
|
||||
(.toEpochMilli instant))
|
||||
|
||||
(defn- pthru [o] (clojure.pprint/pprint o) o)
|
||||
|
||||
(defn- sort-by-create-date [objs]
|
||||
(defn compare-dates [a b]
|
||||
(.isBefore (created-at a) (created-at b)))
|
||||
(sort compare-dates objs))
|
||||
(letfn [(compare-dates [a b]
|
||||
(.isBefore (created-at a) (created-at b)))]
|
||||
(sort compare-dates objs)))
|
||||
|
||||
(defn- remove-posts-by [user posts]
|
||||
(defn post-by-user? [post] (= (id user) (user-id post)))
|
||||
(filter (complement post-by-user?) posts))
|
||||
(letfn [(post-by-user? [post]
|
||||
(= (id user) (user-id post)))]
|
||||
(filter (complement post-by-user?) posts)))
|
||||
|
||||
#_(defn make-lazy-seq
|
||||
([f] (make-lazy-seq f 60))
|
||||
([f delay]
|
||||
(lazy-seq (concat (f) (make-lazy-seq f delay)))))
|
||||
|
||||
(defn- yield-to-channel [coll-gen & { :keys [poll-delay buffer-size] :or {poll-delay 30 buffer-size 10}}]
|
||||
(let [out-chan (chan 10)]
|
||||
(defn- yield-to-channel
|
||||
[coll-gen &
|
||||
{:keys [poll-delay buffer-size]
|
||||
:or {poll-delay 30 buffer-size 10}}]
|
||||
(let [out-chan (chan buffer-size)]
|
||||
(go-loop [result (coll-gen)]
|
||||
(dispatch-result result
|
||||
([os] (doseq [o (sort-by-create-date os)]
|
||||
|
|
Loading…
Reference in New Issue