Print Minecraft time in 12h format

This commit is contained in:
Tanner Collin 2021-05-06 09:58:11 +00:00
parent 343268af24
commit 324ad41bf7

View File

@ -1,5 +1,6 @@
import re import re
import time import time
from datetime import datetime, timedelta
import random import random
from itertools import count from itertools import count
from munch import Munch from munch import Munch
@ -140,7 +141,10 @@ class Commands:
## !time - replies with Minecraft world time ## !time - replies with Minecraft world time
if command == '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 ## !count [id] - counts the number of items with that id
if command == 'count' and data: if command == 'count' and data: