-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathutility.py
30 lines (26 loc) · 1.19 KB
/
utility.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
import re
import hues
from logtype import VirBotLogType
def getRequester(usesPrefix, text):
searchPattern = "(?<=:).+(?=!)" if usesPrefix else ".+(?=!)"
requestMatches = re.search(searchPattern, text, re.I)
if requestMatches:
return str(requestMatches.group())
return ""
def consoleMessage(logtype, message):
if logtype is VirBotLogType.ERROR:
hues.log(hues.huestr("[ERROR] " + message).magenta.bold.colorized)
elif logtype is VirBotLogType.GENERIC:
hues.log(hues.huestr(message).black.colorized)
elif logtype is VirBotLogType.GENERICBOLD:
hues.log(hues.huestr(message).black.bold.colorized)
elif logtype is VirBotLogType.CHANNEL:
hues.log(hues.huestr(message).blue.bold.colorized)
elif logtype is VirBotLogType.NOTICE:
hues.log(hues.huestr("[NOTICE] " + message).blue.bold.colorized)
elif logtype is VirBotLogType.RECEIVED:
hues.log(hues.huestr("[RECEIVED] " + message).green.colorized)
elif logtype is VirBotLogType.SENT:
hues.log(hues.huestr("[SENT] " + message).magenta.bold.colorized)
elif logtype is VirBotLogType.SERVER:
hues.log(hues.huestr("[SERVER] " + message).cyan.bold.colorized)