blob: fc04e2d4a0a74e46abf3fef9af729c647331214d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
import redis, socket, os
from config import config as co
r = redis.Redis(host=co['host'], port=co['port'], unix_socket_path=co['unix_socket_path'], db=co['db'])
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(('8.8.8.8', 80))
host = s.getsockname()[0]
def clear():
"""
clear the window
"""
try:
os.system('clear')
except:
os.system('cls')
def userexist(name):
"""
lista is a list for the set called USERSNAME. check if name is in lista
"""
lista = r.zrange('usersname', 0, -1)
for i in lista:
if name == i.decode('utf-8'):
return True
else:
return False
class PersonalError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
class Colors(object):
red = '\033[91m'
yellow = '\033[93m'
grey = '\033[90m'
black = '\033[0m'
bold = '\033[1m'
|