|
|
@@ -6,8 +6,8 @@
|
|
|
(defparameter +default-group+ "all")
|
|
|
|
|
|
(defun format-mention-group (group)
|
|
|
- (format nil "Але!~{ ~a~^~}" (loop for (user-name) in (db-select "select user_tag from mention_groups where mention_group = ?" group)
|
|
|
- collect (format nil "@~a" user-name))))
|
|
|
+ (format nil "Але!~{ @~a~^~}" (alexandria:flatten (db-select "select user_tag from mention_groups where mention_group = ? and chat_id = ?" group *chat-id*))))
|
|
|
+
|
|
|
(defun handle-mass-mention (group)
|
|
|
(bot-send-message (format-mention-group group) :reply-to *message-id*))
|
|
|
|
|
|
@@ -27,13 +27,13 @@
|
|
|
(log:error "~A" e)))))
|
|
|
|
|
|
(defun db/add-user-to-group (group user-tag)
|
|
|
- (db-execute "insert or ignore into mention_groups (mention_group, user_tag) VALUES (?, ?)" group user-tag))
|
|
|
+ (db-execute "insert or ignore into mention_groups (mention_group, user_tag, chat_id) VALUES (?, ?, ?)" group user-tag *chat-id*))
|
|
|
|
|
|
(defun db/remove-user-from-group (group user-tag)
|
|
|
- (db-execute "delete from mention_groups where mention_group = ? and user_tag = ?" group user-tag))
|
|
|
+ (db-execute "delete from mention_groups where mention_group = ? and user_tag = ? and chat_id = ?" group user-tag *chat-id*))
|
|
|
|
|
|
(def-db-init
|
|
|
- (db-execute "create table if not exists mention_groups (mention_group TEXT, user_tag TEXT, primary key (mention_group, user_tag)) without rowid"))
|
|
|
+ (db-execute "create table if not exists mention_groups (mention_group TEXT, user_tag TEXT, chat_id INTEGER, primary key (mention_group, user_tag, chat_id)) without rowid"))
|
|
|
|
|
|
|
|
|
(def-message-cmd-handler handle-cmd-all (:all)
|