summaryrefslogtreecommitdiff
path: root/lib/classes.py
diff options
context:
space:
mode:
authorSanto Cariotti <sancn@live.com>2017-07-20 14:24:08 +0200
committerSanto Cariotti <sancn@live.com>2017-07-20 14:24:08 +0200
commitb34e6c27aa640e4bd4bde91d684e1e59095ba8b1 (patch)
tree14aa4c5b2b384535c6d379143f441625c7039722 /lib/classes.py
parentfb3d4d39eded67b145aa17eac72ae85c9793bf67 (diff)
Moved files
Moved all files of lib into a lib dir
Diffstat (limited to 'lib/classes.py')
-rw-r--r--lib/classes.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/classes.py b/lib/classes.py
new file mode 100644
index 0000000..7f872af
--- /dev/null
+++ b/lib/classes.py
@@ -0,0 +1,38 @@
+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():
+ try:
+ os.system('clear')
+ except:
+ os.system('cls')
+
+def userexist(name):
+ 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'