Merge pull request #63 from KsaRedFx/develop
Redid SRV lookups in mytools.py due to slow speeds.
This commit is contained in:
commit
c6edec3000
3 changed files with 19 additions and 11 deletions
|
@ -98,7 +98,7 @@ Linux packages needed for install: python, python-dev, libenchant-dev, libenchan
|
||||||
CloudBot runs on **Python** *2.7.x*. It is developed on **Ubuntu** *12.04* with **Python** *2.7.3*.
|
CloudBot runs on **Python** *2.7.x*. It is developed on **Ubuntu** *12.04* with **Python** *2.7.3*.
|
||||||
|
|
||||||
It **requires the Python module** `lXML`, and `Enchant` is needed for the spellcheck plugin.
|
It **requires the Python module** `lXML`, and `Enchant` is needed for the spellcheck plugin.
|
||||||
It also **requires** `pydns` and is needed for SRV record lookup for the mctools plugin.
|
It also **requires** `pydns` and `beautifulsoup4` and is needed for SRV record lookup for the mctools plugin.
|
||||||
|
|
||||||
The programs `daemon` or `screen` are recomended for the launcher to run optimaly.
|
The programs `daemon` or `screen` are recomended for the launcher to run optimaly.
|
||||||
|
|
||||||
|
|
|
@ -116,20 +116,27 @@ def mcping(inp):
|
||||||
"mcping <server>[:port] - Ping a Minecraft server to check status."
|
"mcping <server>[:port] - Ping a Minecraft server to check status."
|
||||||
inp = inp.strip().split(" ")[0]
|
inp = inp.strip().split(" ")[0]
|
||||||
|
|
||||||
|
|
||||||
if ":" in inp:
|
if ":" in inp:
|
||||||
host, port = inp.split(":", 1)
|
host, port = inp.split(":", 1)
|
||||||
try:
|
try:
|
||||||
port = int(port)
|
port = int(port)
|
||||||
except:
|
except:
|
||||||
return "error: invalid port!"
|
return "error: invalid port!"
|
||||||
else:
|
|
||||||
try:
|
|
||||||
getdata = srvData(inp)
|
|
||||||
host = str(getdata[1])
|
|
||||||
port = int(getdata[0])
|
|
||||||
except:
|
|
||||||
host = inp
|
|
||||||
port = 25565
|
|
||||||
return mccolorconvert(mcping_connect(host, port))
|
return mccolorconvert(mcping_connect(host, port))
|
||||||
|
|
||||||
|
else:
|
||||||
|
host = inp
|
||||||
|
port = 25565
|
||||||
|
rdata = mccolorconvert(mcping_connect(host, port))
|
||||||
|
|
||||||
|
if 'is it up' in rdata:
|
||||||
|
getdata = srvData(inp)
|
||||||
|
try:
|
||||||
|
host = str(getdata[1])
|
||||||
|
port = int(getdata[0])
|
||||||
|
return mccolorconvert(mcping_connect(host, port))
|
||||||
|
except:
|
||||||
|
return "Error pinging %s, is it up? Double-check your address!" % inp
|
||||||
|
|
||||||
|
else:
|
||||||
|
return rdata
|
|
@ -2,3 +2,4 @@ BeautifulSoup==3.2.1
|
||||||
lxml==3.1beta1
|
lxml==3.1beta1
|
||||||
pyenchant==1.6.5
|
pyenchant==1.6.5
|
||||||
pydns>=2.3.6
|
pydns>=2.3.6
|
||||||
|
BeautifulSoup4
|
Reference in a new issue