- Create slack app in the UI (the command line ended up creating an unusable app)
- Add these oauth permissions
channels:history channels:read groups:history groups:read im:history mpim:history team:read users:read
- Get admin to approve
- Copy the token
channels:history channels:read groups:history groups:read im:history mpim:history team:read users:read
| (ns drewrbot.core | |
| (:require [clj-slack.users])) | |
| (def username | |
| (memoize | |
| (fn [conn id] | |
| (let [resp (clj-slack.users/info conn id)] | |
| (if (:ok resp) | |
| (select-keys (:user resp) [:real_name :name]) | |
| (throw (ex-info "user error" {:id id | |
| :conn (select-keys conn [:api-url]) | |
| :response resp}))))))) | |
| (defproject drewrbot "0.1.0-SNAPSHOT" | |
| :description "FIXME: write description" | |
| :url "http://example.com/FIXME" | |
| :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0" | |
| :url "https://www.eclipse.org/legal/epl-2.0/"} | |
| :dependencies [[org.clojure/clojure "1.11.1"] | |
| [org.julienxx/clj-slack "0.8.3" | |
| :exclusions [clj-http/clj-http | |
| cheshire/cheshire]] | |
| ;; These aren't technically needed | |
| [clj-http/clj-http "3.13.0"] | |
| [cheshire/cheshire "5.13.0"]] | |
| :repl-options {:init-ns drewrbot.core}) | |
| drewrbot.core> (def tok "xoxb-2404970246-8389136563845-xKuIv*************") | |
| drewrbot.core> (def slack {:api-url "https://slack.com/api" :token tok}) | |
| drewrbot.core> (->> (clj-slack.conversations/replies slack "C07KQSBDZLZ" "1738171244.769229") :messages(map :user) (map (partial username slack)) (into #{})) | |
| #{{:real_name "****", :name "****"} | |
| {:real_name "Drew Raines", :name "drewr"} | |
| {:real_name "****", :name "****"} | |
| {:real_name "****", :name "****"}... |