mirror of
https://github.com/kiranshila/Doplarr.git
synced 2026-04-05 08:53:59 -04:00
Send message to channel that item has been requested
This commit is contained in:
@@ -42,7 +42,7 @@
|
|||||||
(defn request [payload media-type]
|
(defn request [payload media-type]
|
||||||
(a/go
|
(a/go
|
||||||
(let [{:keys [format id season season-count discord-id]} payload
|
(let [{:keys [format id season season-count discord-id]} payload
|
||||||
{:keys [default-id]} env
|
{:overseerr/keys [default-id]} env
|
||||||
details (a/<! (impl/details id media-type))
|
details (a/<! (impl/details id media-type))
|
||||||
ovsr-id ((a/<! (impl/discord-users)) discord-id)
|
ovsr-id ((a/<! (impl/discord-users)) discord-id)
|
||||||
status (impl/media-status details media-type
|
status (impl/media-status details media-type
|
||||||
|
|||||||
@@ -52,6 +52,7 @@
|
|||||||
:type (interaction-types (:type interaction))
|
:type (interaction-types (:type interaction))
|
||||||
:token (:token interaction)
|
:token (:token interaction)
|
||||||
:user-id (s/select-one [:member :user :id] interaction)
|
:user-id (s/select-one [:member :user :id] interaction)
|
||||||
|
:channel-id (:channel-id interaction)
|
||||||
:payload
|
:payload
|
||||||
{:component-type (component-types (get-in interaction [:data :component-type]))
|
{:component-type (component-types (get-in interaction [:data :component-type]))
|
||||||
:component-id (s/select-one [:data :custom-id] interaction)
|
:component-id (s/select-one [:data :custom-id] interaction)
|
||||||
|
|||||||
@@ -94,7 +94,7 @@
|
|||||||
(defmethod process-event! "request" [_ interaction uuid format]
|
(defmethod process-event! "request" [_ interaction uuid format]
|
||||||
(let [{:keys [messaging bot-id]} @state/discord
|
(let [{:keys [messaging bot-id]} @state/discord
|
||||||
{:keys [payload media-type token]} (get @state/cache uuid)
|
{:keys [payload media-type token]} (get @state/cache uuid)
|
||||||
{:keys [user-id]} interaction]
|
{:keys [user-id channel-id]} interaction]
|
||||||
(letfn [(msg-resp [msg] (->> @(m/edit-original-interaction-response! messaging bot-id token (discord/content-response msg))
|
(letfn [(msg-resp [msg] (->> @(m/edit-original-interaction-response! messaging bot-id token (discord/content-response msg))
|
||||||
(else #(fatal % "Error in message response"))))]
|
(else #(fatal % "Error in message response"))))]
|
||||||
(->> (log-on-error
|
(->> (log-on-error
|
||||||
@@ -109,7 +109,9 @@
|
|||||||
:processing (msg-resp "This is currently processing and should be available soon!")
|
:processing (msg-resp "This is currently processing and should be available soon!")
|
||||||
:available (msg-resp "This selection is already available!")
|
:available (msg-resp "This selection is already available!")
|
||||||
(do
|
(do
|
||||||
#_(m/create-message! messaging)
|
(m/create-message! messaging channel-id
|
||||||
|
:content
|
||||||
|
(str "<@" user-id "> has requested the " (name media-type) " " (:title payload) " and it should be available soon!"))
|
||||||
(msg-resp "Request performed!")))))
|
(msg-resp "Request performed!")))))
|
||||||
(else (fn [e]
|
(else (fn [e]
|
||||||
(let [{:keys [status body] :as data} (ex-data e)]
|
(let [{:keys [status body] :as data} (ex-data e)]
|
||||||
|
|||||||
Reference in New Issue
Block a user