Fix group commands

This commit is contained in:
janherich 2018-01-08 15:01:44 +01:00
parent c99af08c4f
commit d98f3846fd
No known key found for this signature in database
GPG Key ID: C23B473AFBE94D13
1 changed files with 23 additions and 20 deletions

View File

@ -245,7 +245,7 @@
metadata metadata
args] args]
:as content} :content :as content} :content
:keys [chat-id jail-id data-type event-after-creator message-id current-time]}] :keys [chat-id group-id jail-id data-type event-after-creator message-id current-time]}]
(let [{:keys [dapp? dapp-url name]} (get contacts chat-id) (let [{:keys [dapp? dapp-url name]} (get contacts chat-id)
metadata (merge metadata metadata (merge metadata
(when dapp? (when dapp?
@ -267,6 +267,7 @@
request-data {:message-id message-id request-data {:message-id message-id
:chat-id chat-id :chat-id chat-id
:group-id group-id
:jail-id (or owner-id jail-id) :jail-id (or owner-id jail-id)
:content {:command (:name command) :content {:command (:name command)
:scope-bitmask (:scope-bitmask command) :scope-bitmask (:scope-bitmask command)
@ -290,9 +291,11 @@
If it's normal command instead (determined by nil response to `:on-send` jail request), If it's normal command instead (determined by nil response to `:on-send` jail request),
processing continues by requesting command preview before actually sending the command processing continues by requesting command preview before actually sending the command
message." message."
[{:keys [current-chat-id] :as db} {{:keys [bot]} :command :as content} message-id current-time] [{:keys [current-chat-id chats] :as db} {{:keys [bot]} :command :as content} message-id current-time]
(let [params-template {:content content (let [params-template {:content content
:chat-id current-chat-id :chat-id current-chat-id
:group-id (when (get-in chats [current-chat-id :group-chat])
current-chat-id)
:jail-id (or bot current-chat-id) :jail-id (or bot current-chat-id)
:message-id message-id :message-id message-id
:current-time current-time} :current-time current-time}