music-kraken-core/music_kraken/utils/__init__.py

28 lines
620 B
Python
Raw Normal View History

2024-04-09 10:42:06 +00:00
from datetime import datetime
2023-06-20 14:40:34 +00:00
from .config import config, read_config, write_config
from .enums.colors import BColors
"""
Here are all global important functions.
"""
def _apply_color(msg: str, color: BColors) -> str:
if color is BColors.ENDC:
return msg
return color.value + msg + BColors.ENDC.value
def output(msg: str, color: BColors = BColors.ENDC):
print(_apply_color(msg, color))
def user_input(msg: str, color: BColors = BColors.ENDC):
return input(_apply_color(msg, color)).strip()
2024-04-09 10:42:06 +00:00
def get_current_millis() -> int:
dt = datetime.now()
return int(dt.microsecond / 1_000)