forked from ben/bitbot-modules
16 lines
587 B
Python
16 lines
587 B
Python
from src import ModuleManager, utils
|
|
from datetime import datetime, timedelta, timezone
|
|
|
|
|
|
class Module(ModuleManager.BaseModule):
|
|
_name = ".beat"
|
|
|
|
@utils.hook("received.command.beat")
|
|
@utils.kwarg("help", "Gives the current .beat time")
|
|
def beat(self, event):
|
|
# https://en.wikipedia.org/wiki/Swatch_Internet_Time
|
|
# UTC + 1 / Biel Mean Time
|
|
now = datetime.now(timezone(timedelta(hours=1)))
|
|
beat_time = ((now.hour * 3600) + (now.minute * 60) + now.second) / 86.4
|
|
event["stdout"].write(f"The current .beat time is @{beat_time:0.2f}")
|