add beat.py

@khukxm
https://github.com/jesopo/bitbot/pull/323/files
This commit is contained in:
Ben Harris 2021-08-02 15:38:40 -04:00
parent 55b4101efc
commit 0ab9cc662e
1 changed files with 13 additions and 0 deletions

13
beat.py Normal file
View File

@ -0,0 +1,13 @@
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):
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}")