build.utils.db_api.set_ban_members.ban_members()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 18
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 18
rs 10
c 0
b 0
f 0
cc 1
nop 2
1
# -*- coding: utf-8 -*-
2
3
4
from utils.db_api.creat_db import db, cursor
5
6
7
"""
8
9
10
    Created on 24.09.2021
11
    
12
    @author: Nikita
13
14
15
"""
16
17
18
async def ban_members(user_id, time_out):
19
20
    """
21
22
    The function is designed to ban the chat user.
23
24
    """
25
26
    add_members = f"""
27
                    INSERT 
28
                    INTO banned_chat_members (user_id, time_out) 
29
                    VALUES ({user_id}, FROM_UNIXTIME({time_out})) 
30
                    ON DUPLICATE KEY UPDATE time_out = time_out
31
                    """
32
33
    cursor.execute(add_members)
34
35
    db.commit()
36