45 lines
No EOL
1.8 KiB
Python
45 lines
No EOL
1.8 KiB
Python
# Replacement for services bots.
|
|
import traceback
|
|
__ircat_type__ = "command"
|
|
__ircat_requires__ = []
|
|
__ircat_giveme__ = ["sql"] # Only command and allsocket have these.
|
|
__ircat_fakeusers__ = {
|
|
"NickServ": {
|
|
"host": "PawServ",
|
|
"username": "Meow",
|
|
"realname": "PawServ plugin - Identification bot",
|
|
"modes": "iw", "away": False
|
|
},
|
|
"ChanServ": {
|
|
"host": "PawServ",
|
|
"username": "Meow",
|
|
"realname": "PawServ plugin - Channel management bot",
|
|
"modes": "iw",
|
|
"away": False
|
|
}
|
|
}
|
|
class IRCatModule:
|
|
def __init__(self, sql):
|
|
self.sql = sql
|
|
print("PawServ loaded!")
|
|
def command(self, command, args, ip, nick, connection, user):
|
|
try:
|
|
if command == "NICKSERV" or (command == "PRIVMSG" and args[0].lower() == "nickserv"):
|
|
if command == "PRIVMSG":
|
|
args = args[1:]
|
|
args[0] = args[0][1:] if args[0][0] == ":" else args[0]
|
|
if len(args) > 0 and args[0].lower() == "identify":
|
|
temp = self.sql.nickserv_identify(nick=nick if len(args) == 2 else args[2], password=args[1])
|
|
if temp:
|
|
pass
|
|
else:
|
|
connection.sendall(bytes(f":NickServ!Meow@PawServ NOTICE {nick} :Invalid username/password.\r\n", "UTF-8"))
|
|
else:
|
|
connection.sendall(bytes(f":NickServ!Meow@PawServ NOTICE {nick} :NickServ Usage:\r\n","UTF-8"))
|
|
connection.sendall(bytes(f":NickServ!Meow@PawServ NOTICE {nick} :IDENTIFY pass <nick> - Identifies your nickname\r\n","UTF-8"))
|
|
return True
|
|
else:
|
|
return False
|
|
except:
|
|
print(traceback.format_exc())
|
|
return False |