Total Complexity | 1 |
Total Lines | 37 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | # -*- coding: utf-8 -*- |
||
2 | |||
3 | |||
4 | from utils.db_api.creat_db import cursor |
||
5 | |||
6 | |||
7 | """ |
||
8 | |||
9 | |||
10 | Created on 24.09.2021 |
||
11 | |||
12 | @author: Nikita |
||
13 | |||
14 | |||
15 | """ |
||
16 | |||
17 | |||
18 | async def unban_member(user_id, ban_time): |
||
19 | |||
20 | """ |
||
21 | |||
22 | The function is designed to unban the chat user. |
||
23 | |||
24 | """ |
||
25 | |||
26 | del_members = f"DELETE from banned_chat_members WHERE time_out < DATE_SUB(NOW(), INTERVAL {ban_time} SECOND)" |
||
27 | |||
28 | add_members = f"""SELECT user_id FROM banned_chat_members WHERE user_id={user_id}""" |
||
29 | |||
30 | cursor.execute(del_members) |
||
31 | cursor.execute(add_members) |
||
32 | |||
33 | result = cursor.fetchall() |
||
34 | result = [row[0] for row in result] |
||
35 | |||
36 | return result |
||
37 |