updated static data, added .update_data command
This commit is contained in:
parent
2bd7d74e91
commit
e4599dbd9c
|
@ -6,7 +6,7 @@ All static data came from https://github.com/WFCD/warframe-worldstate-data
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
Python 3.6+
|
Python 3.6+
|
||||||
Python packages: `twisted requests`
|
Python packages: `twisted service_identity requests`
|
||||||
|
|
||||||
## Config
|
## Config
|
||||||
`server` - Server address.
|
`server` - Server address.
|
||||||
|
|
16189
static/languages.json
16189
static/languages.json
File diff suppressed because one or more lines are too long
|
@ -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"
|
|
||||||
}
|
|
||||||
}
|
|
1793
static/solNodes.json
1793
static/solNodes.json
File diff suppressed because one or more lines are too long
31
warbot.py
31
warbot.py
|
@ -15,6 +15,9 @@ from twisted.internet import protocol, reactor
|
||||||
from twisted.words.protocols import irc
|
from twisted.words.protocols import irc
|
||||||
|
|
||||||
URI = "http://content.warframe.com/dynamic/worldState.php"
|
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):
|
class ClockThread(threading.Thread):
|
||||||
|
@ -184,6 +187,34 @@ class WarBot(irc.IRCClient):
|
||||||
self.notice(user.partition('!')[0], msg)
|
self.notice(user.partition('!')[0], msg)
|
||||||
return
|
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):
|
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