Print Minecraft time in 12h format

master
Tanner Collin 3 years ago
parent 343268af24
commit 324ad41bf7
  1. 6
      mosfet/commands.py

@ -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:

Loading…
Cancel
Save