added cetus day/night cycle
This commit is contained in:
parent
e4599dbd9c
commit
e4053bace1
19
warbot.py
19
warbot.py
|
@ -19,6 +19,8 @@ DATA_LANG = "https://raw.githubusercontent.com/WFCD/warframe-worldstate-data/mas
|
||||||
DATA_MISS = "https://raw.githubusercontent.com/WFCD/warframe-worldstate-data/master/data/missionTypes.json"
|
DATA_MISS = "https://raw.githubusercontent.com/WFCD/warframe-worldstate-data/master/data/missionTypes.json"
|
||||||
DATA_SOL = "https://raw.githubusercontent.com/WFCD/warframe-worldstate-data/master/data/solNodes.json"
|
DATA_SOL = "https://raw.githubusercontent.com/WFCD/warframe-worldstate-data/master/data/solNodes.json"
|
||||||
|
|
||||||
|
CETUS_EPOCH = 1550435808
|
||||||
|
|
||||||
|
|
||||||
class ClockThread(threading.Thread):
|
class ClockThread(threading.Thread):
|
||||||
"""
|
"""
|
||||||
|
@ -215,6 +217,23 @@ class WarBot(irc.IRCClient):
|
||||||
self.msg(channel, "Data stores updated.")
|
self.msg(channel, "Data stores updated.")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if message.startswith(".cetus"):
|
||||||
|
res = requests.get(URI, verify=True)
|
||||||
|
res.raise_for_status()
|
||||||
|
data = res.json()
|
||||||
|
|
||||||
|
delta = (data['Time'] - CETUS_EPOCH) % (150*60)
|
||||||
|
if delta > (100*60):
|
||||||
|
status = "Night"
|
||||||
|
eta = ((150*60) - delta, 'Day')
|
||||||
|
else:
|
||||||
|
status = "Day"
|
||||||
|
eta = ((100*60) - delta, 'Night')
|
||||||
|
msg = f"\x0310Cetus time\x0300: \x0312{status}\x0300 | "
|
||||||
|
msg += f"\x0310Time until \x0312{eta[1]}\x0300: "
|
||||||
|
msg += f"\x0308{eta[0]//60}m"
|
||||||
|
self.msg(channel, msg)
|
||||||
|
|
||||||
|
|
||||||
def joined(self, channel):
|
def joined(self, channel):
|
||||||
"""Called when the bot joins a new channel."""
|
"""Called when the bot joins a new channel."""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user