build.utils.db_api.set_ban_members   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 6
dl 0
loc 36
rs 10
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A ban_members() 0 18 1
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