Update server.py
This commit is contained in:
parent
f2af8f9d93
commit
bc2ac53b7c
1 changed files with 10 additions and 10 deletions
20
server.py
20
server.py
|
@ -35,23 +35,23 @@ class IRCat_DATA_BROKER:
|
|||
open(data_path, "w").write("")
|
||||
self.conn = sqlite3.connect(data_path)
|
||||
db = self.conn.cursor()
|
||||
self.db.execute(''' SELECT count(name) FROM sqlite_master WHERE type='table' AND name='nickserv' ''')
|
||||
if self.db.fetchall()[0]!=1:
|
||||
db.execute(''' SELECT count(name) FROM sqlite_master WHERE type='table' AND name='nickserv' ''')
|
||||
if db.fetchall()[0]!=1:
|
||||
print("Creating NickServ table...")
|
||||
self.db.execute("""CREATE table nickserv (user varchar(255), modes varchar(255), hash varchar(255), nicks varchar(255))""")
|
||||
self.db.execute(''' SELECT count(name) FROM sqlite_master WHERE type='table' AND name='groups' ''')
|
||||
if self.db.fetchall()[0]!=1:
|
||||
db.execute("""CREATE table nickserv (user varchar(255), modes varchar(255), hash varchar(255), nicks varchar(255))""")
|
||||
db.execute(''' SELECT count(name) FROM sqlite_master WHERE type='table' AND name='groups' ''')
|
||||
if db.fetchall()[0]!=1:
|
||||
print("Creating Groups table...")
|
||||
self.db.execute("""CREATE table groups (name varchar(255), owner varchar(255))""")
|
||||
self.db.execute(''' SELECT count(name) FROM sqlite_master WHERE type='table' AND name='chanserv' ''')
|
||||
if self.db.fetchall()[0]!=1:
|
||||
db.execute("""CREATE table groups (name varchar(255), owner varchar(255))""")
|
||||
db.execute(''' SELECT count(name) FROM sqlite_master WHERE type='table' AND name='chanserv' ''')
|
||||
if db.fetchall()[0]!=1:
|
||||
print("Creating ChanServ table...")
|
||||
self.db.execute("""CREATE table chanserv (name varchar(255), modes varchar(255), params varchar(255), owner varchar(255), usermodes varchar(255), optimodes varchar(255))""")
|
||||
db.execute("""CREATE table chanserv (name varchar(255), modes varchar(255), params varchar(255), owner varchar(255), usermodes varchar(255), optimodes varchar(255))""")
|
||||
def nickserv_identify(self, nick, password:str):
|
||||
db = self.conn.cursor()
|
||||
password = password.encode("UTF-8")
|
||||
db.execute("SELECT * FROM nickserv WHERE user=?;", [nick])
|
||||
if self.db.fetchall() == []:
|
||||
if db.fetchall() == []:
|
||||
return ["Nickname doesn't exist."]
|
||||
|
||||
config = IRCat_DATA_BROKER()
|
||||
|
|
Loading…
Reference in a new issue