|
|
|
@ -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)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|