updated static data, added .update_data command

This commit is contained in:
iou1name 2019-01-11 13:01:48 -05:00
parent 2bd7d74e91
commit e4599dbd9c
5 changed files with 35 additions and 18040 deletions

View File

@ -6,7 +6,7 @@ All static data came from https://github.com/WFCD/warframe-worldstate-data
## Requirements
Python 3.6+
Python packages: `twisted requests`
Python packages: `twisted service_identity requests`
## Config
`server` - Server address.

File diff suppressed because one or more lines are too long

View File

@ -1,59 +1 @@
{
"MT_EXCAVATE": {
"value": "Excavation"
},
"MT_SABOTAGE": {
"value": "Sabotage"
},
"MT_MOBILE_DEFENSE": {
"value": "Mobile Defense"
},
"MT_ASSASSINATION": {
"value": "Assassination"
},
"MT_EXTERMINATION": {
"value": "Extermination"
},
"MT_HIVE": {
"value": "Hive"
},
"MT_DEFENSE": {
"value": "Defense"
},
"MT_TERRITORY": {
"value": "Interception"
},
"MT_ARENA": {
"value": "Rathuum"
},
"MT_PVP": {
"value": "Conclave"
},
"MT_RESCUE": {
"value": "Rescue"
},
"MT_INTEL": {
"value": "Spy"
},
"MT_SURVIVAL": {
"value": "Survival"
},
"MT_CAPTURE": {
"value": "Capture"
},
"MT_SECTOR": {
"value": "Dark Sector"
},
"MT_RETRIEVAL": {
"value": "Hijack"
},
"MT_ASSAULT": {
"value": "Assault"
},
"MT_EVACUATION": {
"value": "Defection"
},
"MT_LANDSCAPE": {
"value": "Free Roam"
}
}
{"MT_EXCAVATE": {"value": "Excavation"}, "MT_SABOTAGE": {"value": "Sabotage"}, "MT_MOBILE_DEFENSE": {"value": "Mobile Defense"}, "MT_ASSASSINATION": {"value": "Assassination"}, "MT_EXTERMINATION": {"value": "Extermination"}, "MT_HIVE": {"value": "Hive"}, "MT_DEFENSE": {"value": "Defense"}, "MT_TERRITORY": {"value": "Interception"}, "MT_ARENA": {"value": "Rathuum"}, "MT_PVP": {"value": "Conclave"}, "MT_RESCUE": {"value": "Rescue"}, "MT_INTEL": {"value": "Spy"}, "MT_SURVIVAL": {"value": "Survival"}, "MT_CAPTURE": {"value": "Capture"}, "MT_SECTOR": {"value": "Dark Sector"}, "MT_RETRIEVAL": {"value": "Hijack"}, "MT_ASSAULT": {"value": "Assault"}, "MT_EVACUATION": {"value": "Defection"}, "MT_LANDSCAPE": {"value": "Free Roam"}}

File diff suppressed because one or more lines are too long

View File

@ -15,6 +15,9 @@ from twisted.internet import protocol, reactor
from twisted.words.protocols import irc
URI = "http://content.warframe.com/dynamic/worldState.php"
DATA_LANG = "https://raw.githubusercontent.com/WFCD/warframe-worldstate-data/master/data/languages.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"
class ClockThread(threading.Thread):
@ -184,6 +187,34 @@ class WarBot(irc.IRCClient):
self.notice(user.partition('!')[0], msg)
return
if message.startswith(".update_data"):
try:
res = requests.get(DATA_LANG, verify=True)
res.raise_for_status()
self.languages = res.json()
res = requests.get(DATA_MISS, verify=True)
res.raise_for_status()
self.missionTypes = res.json()
res = requests.get(DATA_SOL, verify=True)
res.raise_for_status()
self.solNodes = res.json()
except requests.RequestException:
self.msg(channel, "Error: Could not update data.")
with open(os.path.join("static", "languages.json"), "w") as file:
file.write(json.dumps(self.languages))
with open(os.path.join("static", "missionTypes.json"),"w") as file:
file.write(json.dumps(self.missionTypes))
with open(os.path.join("static", "solNodes.json"), "w") as file:
file.write(json.dumps(self.solNodes))
self.msg(channel, "Data stores updated.")
return
def joined(self, channel):
"""Called when the bot joins a new channel."""