From 6c78244efae7680889eeb13a11caf9e8c84648be Mon Sep 17 00:00:00 2001 From: Alexei Date: Sat, 4 Nov 2023 13:31:56 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D1=82=D0=B5=D0=BB=D1=8F=20=D0=B2=20=D0=B3=D1=80=D1=83?= =?UTF-8?q?=D0=BF=D0=BF=D1=83=20=D0=BF=D0=BE=D1=81=D0=BB=D0=B5=20=D0=B0?= =?UTF-8?q?=D0=B2=D1=82=D0=BE=D1=80=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D0=B8=20?= =?UTF-8?q?#9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bot_modules/users_groups_agregator.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bot_modules/users_groups_agregator.py b/bot_modules/users_groups_agregator.py index 7c29fe7..e26b55d 100644 --- a/bot_modules/users_groups_agregator.py +++ b/bot_modules/users_groups_agregator.py @@ -101,8 +101,10 @@ class ModuleUsersGroupsAgregator(mod_simple_message.SimpleMessageModule): def AddUserInGroup(a_Bot, a_UserID, a_GroupName): g_id = a_Bot.SQLRequest(f'SELECT {groups.key_name} FROM {groups.table_name} WHERE {groups.name_field} = "{a_GroupName}"'); - print ('AddUserInGroup', g_id) if not g_id or len(g_id) != 1 or len(g_id[0]) != 1: return False group_id = g_id[0][0] - a_Bot.SQLRequest(f'INSERT INTO {user_in_groups.table_name}({user_in_groups.name_field}, {user_in_groups.parent_id_field}) VALUES({a_UserID}, {group_id})') + r = f'INSERT OR IGNORE INTO {user_in_groups.table_name}({user_in_groups.name_field}, {user_in_groups.parent_id_field}) VALUES(?, ?)' + result = a_Bot.SQLRequest(r, commit=True, param = (a_UserID, group_id)) + +