|
@@ -1,3 +1,4 @@
|
|
|
|
|
+import secrets, string
|
|
|
from common import userstatus, do_everything_to
|
|
from common import userstatus, do_everything_to
|
|
|
from commands.common import CommandHelpers as CH
|
|
from commands.common import CommandHelpers as CH
|
|
|
from commands.common import AdminHelpers as AH
|
|
from commands.common import AdminHelpers as AH
|
|
@@ -37,6 +38,8 @@ def do_command(self, connection, event):
|
|
|
message += CH.ccc(self, "reconnect", {"homechan": "oper", "chan": None}, event)
|
|
message += CH.ccc(self, "reconnect", {"homechan": "oper", "chan": None}, event)
|
|
|
if CH.ccc(self, "recovernick", {"homechan": "oper", "chan": None}, event):
|
|
if CH.ccc(self, "recovernick", {"homechan": "oper", "chan": None}, event):
|
|
|
message += CH.ccc(self, "recovernick", {"homechan": "oper", "chan": None}, event)
|
|
message += CH.ccc(self, "recovernick", {"homechan": "oper", "chan": None}, event)
|
|
|
|
|
+ if CH.ccc(self, "registernick", {"homechan": "owner", "chan": None}, event):
|
|
|
|
|
+ message += CH.ccc(self, "registernick", {"homechan": "oener", "chan": None}, event)
|
|
|
if CH.ccc(self, "msg", {"homechan": "oper", "chan": "oper"}, event):
|
|
if CH.ccc(self, "msg", {"homechan": "oper", "chan": "oper"}, event):
|
|
|
message += CH.ccc(self, "msg", {"homechan": "oper", "chan": "oper"}, event)
|
|
message += CH.ccc(self, "msg", {"homechan": "oper", "chan": "oper"}, event)
|
|
|
if CH.ccc(self, "act", {"homechan": "oper", "chan": "oper"}, event):
|
|
if CH.ccc(self, "act", {"homechan": "oper", "chan": "oper"}, event):
|
|
@@ -285,3 +288,26 @@ def do_command(self, connection, event):
|
|
|
return
|
|
return
|
|
|
else: # Too many arguments.
|
|
else: # Too many arguments.
|
|
|
connection.privmsg(replyto, "Too many arguments. For help type " + blue + self.helpchar + "channelfunctions" + reset + ".")
|
|
connection.privmsg(replyto, "Too many arguments. For help type " + blue + self.helpchar + "channelfunctions" + reset + ".")
|
|
|
|
|
+
|
|
|
|
|
+ elif command.split()[0] == "registernick":
|
|
|
|
|
+ if not userstatus.atleast_owner(self, event.source.nick, self.homechannel): #Insufficient rights.
|
|
|
|
|
+ connection.privmsg(replyto, "Denied, you need to be the owner of " + red + self.homechannel + reset + ".")
|
|
|
|
|
+ return
|
|
|
|
|
+ if cmdtype == "help": # Display help text.
|
|
|
|
|
+ if len(command.split()) is not 1:
|
|
|
|
|
+ return
|
|
|
|
|
+ connection.privmsg(replyto, "Register with NickServ.")
|
|
|
|
|
+ connection.privmsg(replyto, grey + "Usage: " + blue + self.cmdchar + "registernick " + reset + italic + "email")
|
|
|
|
|
+ elif cmdtype == "cmd":
|
|
|
|
|
+
|
|
|
|
|
+ if len(command.split()) == 1:
|
|
|
|
|
+ connection.privmsg(replyto, "Insufficient arguments. For help type " + blue + self.helpchar + "registernick" + reset + ".")
|
|
|
|
|
+ elif len(command.split()) > 2:
|
|
|
|
|
+ connection.privmsg(replyto, "Too many arguments. For help type " + blue + self.helpchar + "registernick" + reset + ".")
|
|
|
|
|
+ elif not self.db.one("SELECT password FROM networks WHERE name='" + self.network + "'"):
|
|
|
|
|
+ alphabet = string.ascii_letters + string.digits
|
|
|
|
|
+ password = ''.join(secrets.choice(alphabet) for i in range(20)) # 20-character password.
|
|
|
|
|
+ self.db.run("UPDATE networks SET password=%s WHERE name=%s", (password, self.network))
|
|
|
|
|
+ connection.privmsg("NickServ", "REGISTER " + password + " " + trigger.split()[1])
|
|
|
|
|
+ else:
|
|
|
|
|
+ connection.action("NickServ", "REGISTER " + self.db.one("SELECT password FROM networks WHERE name='" + self.network + "'") + " " + trigger.split()[1])
|