36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
import main
|
|
from utils.get import getRelay
|
|
|
|
|
|
class GetstrCommand:
|
|
def __init__(self, *args):
|
|
self.getstr(*args)
|
|
|
|
def getstr(
|
|
self, addr, authed, data, obj, spl, success, failure, info, incUsage, length
|
|
):
|
|
if authed:
|
|
if length == 3:
|
|
net = spl[1]
|
|
num = spl[2]
|
|
if net not in main.network.keys():
|
|
failure("Network does not exist: %s" % net)
|
|
return
|
|
if not num.isdigit():
|
|
failure("Must be a number, not %s" % num)
|
|
return
|
|
num = int(num)
|
|
alias = main.alias[num]["nick"].lower()
|
|
host, port = getRelay(num)
|
|
password = main.config["Relay"]["Password"]
|
|
connstr = f"/connect -ssl {host} {port}"
|
|
authstr = f"/quote PASS {alias}/{net}:{password}"
|
|
obj.send(connstr)
|
|
obj.send(authstr)
|
|
|
|
else:
|
|
incUsage("getstr")
|
|
return
|
|
else:
|
|
incUsage(None)
|