forked from self-aware-git/exchange-rates-tg-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNewPrint.py
46 lines (40 loc) · 1.78 KB
/
NewPrint.py
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
45
46
from aiogram.types.message import ContentType
consoleLog = True
import datetime
counterS = 0
counterL = 0
counterE = 0
def Print(printingText: str, status: str = ""):
printingText = str(printingText)
global counterS, counterL, counterE
if consoleLog or status == "E" or status == "e" or status == "S" or status == "s":
status = status.lower()
if status == 's':
print("\033[36m{} ".format("Service") + "\033[37m{}".format(str(counterS)) + ": "+ printingText)
counterS += 1
elif status == 'e':
print("\033[31m{} ".format("Error") + "\033[37m{}".format(str(counterE)) + ": "+ printingText)
counterE += 1
elif status == 'l':
print("\033[32m{} ".format("Log") + "\033[37m{}".format(str(counterL)) + ": "+ printingText)
counterL += 1
elif status == 'w':
print("\033[33m{} ".format("Warning") + "\033[37m{}".format(str(counterL)) + ": "+ printingText)
counterL += 1
elif status == '':
print(printingText)
def EnableLogging():
global consoleLog
consoleLog = True
def DisableLogging():
global consoleLog
consoleLog = False
def PrintMainInfo(mes, mestxt: str):
now = datetime.datetime.now()
Print("","")
Print("******************************","")
Print(now.strftime("%d-%m-%Y %H:%M:%S"),"L")
Print("Username: " + str(mes.from_user.username) + " | User ID: " + str(mes.from_user.id) + " | First name: " + str(mes.from_user.first_name) + " | Last name: " + str(mes.from_user.last_name), "L")
Print("Chat ID: " + str(mes.chat.id) + " | Chat name: " + str(mes.chat.title) + " | Chat username: "+str(mes.chat.username) + " | Chat type: "+str(mes.chat.type), "L")
Print("","")
Print("Message: " + str(mestxt), "L")