From 324ad41bf79c7d49c8694611a55c386803b3b865 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Thu, 6 May 2021 09:58:11 +0000 Subject: [PATCH] Print Minecraft time in 12h format --- mosfet/commands.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mosfet/commands.py b/mosfet/commands.py index 5771f7f..83de7ef 100644 --- a/mosfet/commands.py +++ b/mosfet/commands.py @@ -1,5 +1,6 @@ import re import time +from datetime import datetime, timedelta import random from itertools import count from munch import Munch @@ -140,7 +141,10 @@ class Commands: ## !time - replies with Minecraft world time if command == 'time': - reply = str(self.g.time) + seconds = self.g.time * 3.6 + start = datetime(2000, 1, 1, hour=6) + mctime = start + timedelta(seconds=seconds) + reply = str(self.g.time) + ' - ' + mctime.strftime('%I:%M %p') ## !count [id] - counts the number of items with that id if command == 'count' and data: