|
|
@@ -17,6 +17,11 @@
|
|
|
(defun remove-user-from-group (group mentions)
|
|
|
(apply-to-mentions group mentions #'db/remove-user-from-group "Удалил ~{~a~^,~} из группы ~a."))
|
|
|
|
|
|
+(defun apply-contol-function (args func)
|
|
|
+ (cond
|
|
|
+ ((equalp (subseq (second args) 0 1) "@") (funcall func +default-group+ (cdr *args*)))
|
|
|
+ (:otherwise (funcall func (second args) (subseq *args* 2)))))
|
|
|
+
|
|
|
(defun apply-to-mentions (group mentions func message)
|
|
|
(handler-case (progn
|
|
|
(loop for name in mentions
|
|
|
@@ -39,6 +44,6 @@
|
|
|
(def-message-cmd-handler handle-cmd-all (:all)
|
|
|
(cond
|
|
|
((= 1 (length *args*)) (handle-mass-mention (car *args*)))
|
|
|
- ((equalp "add" (car *args*)) (add-user-to-group (second *args*) (subseq *args* 2)))
|
|
|
- ((equalp "remove" (car *args*)) (remove-user-from-group (second *args*) (subseq *args* 2)))
|
|
|
+ ((equalp "add" (car *args*)) (apply-contol-function *args* #'add-user-to-group))
|
|
|
+ ((equalp "remove" (car *args*)) (apply-contol-function *args* #'remove-user-from-group))
|
|
|
(:otherwise (handle-mass-mention +default-group+))))
|