mothertruckers
This commit is contained in:
parent
41f5e64023
commit
b7f3d29f6e
1 changed files with 4 additions and 10 deletions
|
@ -1,19 +1,13 @@
|
||||||
from util import hook
|
from util import hook
|
||||||
from util import http
|
from util import http
|
||||||
from util.text import get_text_list
|
from util.text import get_text_list
|
||||||
import dns.resolver
|
|
||||||
import string
|
import string
|
||||||
import socket
|
import socket
|
||||||
import json
|
import json
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
|
|
||||||
def mcping_connect(host, port=None):
|
def mcping_connect(host, port):
|
||||||
try:
|
|
||||||
answers = dns.resolver.query('_minecraft._tcp.' + host, 'SRV')
|
|
||||||
except dns.resolver.NoAnswer:
|
|
||||||
if not port:
|
|
||||||
port = 25565
|
|
||||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
try:
|
try:
|
||||||
sock.connect((host, port))
|
sock.connect((host, port))
|
||||||
|
@ -67,6 +61,7 @@ def mcstatus(inp, say=None):
|
||||||
return ", ".join(out) + "."
|
return ", ".join(out) + "."
|
||||||
|
|
||||||
|
|
||||||
|
@hook.command("haspaid")
|
||||||
@hook.command
|
@hook.command
|
||||||
def mcpaid(inp):
|
def mcpaid(inp):
|
||||||
"mcpaid <username> -- Checks if <username> has a" \
|
"mcpaid <username> -- Checks if <username> has a" \
|
||||||
|
@ -90,8 +85,7 @@ def mcping(inp):
|
||||||
port = int(port)
|
port = int(port)
|
||||||
except:
|
except:
|
||||||
return "error: invalid port!"
|
return "error: invalid port!"
|
||||||
return mcping_connect(host, port)
|
|
||||||
else:
|
else:
|
||||||
host = inp
|
host = inp
|
||||||
return mcping_connect(host)
|
port = 25565
|
||||||
|
return mcping_connect(host, port)
|
||||||
|
|
Reference in a new issue