mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-10-09 05:17:29 +02:00
Changed NOTNULL to NOT NULL and the order of the methods (yeah, I'm anal)
This commit is contained in:
parent
e962cc1d77
commit
7a3d06a2bb
@ -45,6 +45,9 @@ Commands include:
|
|||||||
insult
|
insult
|
||||||
addinsult
|
addinsult
|
||||||
removeinsult
|
removeinsult
|
||||||
|
numinsults
|
||||||
|
numexcuses
|
||||||
|
numlarts
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from baseplugin import *
|
from baseplugin import *
|
||||||
@ -82,6 +85,10 @@ def makeDb(dbfilename, replace=False):
|
|||||||
id INTEGER PRIMARY KEY,
|
id INTEGER PRIMARY KEY,
|
||||||
lart TEXT
|
lart TEXT
|
||||||
)""")
|
)""")
|
||||||
|
cursor.execute("""CREATE TABLE praises (
|
||||||
|
id INTEGER PRIMARY KEY,
|
||||||
|
praise TEXT
|
||||||
|
)""")
|
||||||
cursor.execute("""CREATE TABLE words (
|
cursor.execute("""CREATE TABLE words (
|
||||||
id INTEGER PRIMARY KEY,
|
id INTEGER PRIMARY KEY,
|
||||||
word TEXT UNIQUE ON CONFLICT IGNORE,
|
word TEXT UNIQUE ON CONFLICT IGNORE,
|
||||||
@ -122,13 +129,32 @@ class FunDB(callbacks.Privmsg):
|
|||||||
|
|
||||||
def die(self):
|
def die(self):
|
||||||
self.db.close()
|
self.db.close()
|
||||||
|
"""
|
||||||
|
def praise(self, irc, msg, args):
|
||||||
|
"""<something>
|
||||||
|
|
||||||
|
Praises <something> with a praise from my vast database of praises.
|
||||||
|
"""
|
||||||
|
something = privmsgs.getArgs(args)
|
||||||
|
if something == 'me':
|
||||||
|
something = msg.nick
|
||||||
|
elif something == 'yourself':
|
||||||
|
something = irc.nick
|
||||||
|
cursor = self.db.cursor()
|
||||||
|
cursor.execute("""SELECT id, praise FROM praises
|
||||||
|
WHERE praise NOT NULL
|
||||||
|
ORDER BY random()
|
||||||
|
LIMIT 1""")
|
||||||
|
(id, insult) = cursor.fetchone()
|
||||||
|
s = insul
|
||||||
|
irc.queueMsg(ircmsgs.action(ircutils.replyTo(msg),
|
||||||
|
"""
|
||||||
def insult(self, irc, msg, args):
|
def insult(self, irc, msg, args):
|
||||||
"""<nick>"""
|
"""<nick>"""
|
||||||
nick = privmsgs.getArgs(args)
|
nick = privmsgs.getArgs(args)
|
||||||
cursor = self.db.cursor()
|
cursor = self.db.cursor()
|
||||||
cursor.execute("""SELECT id, insult FROM insults
|
cursor.execute("""SELECT id, insult FROM insults
|
||||||
WHERE insult NOTNULL
|
WHERE insult NOT NULL
|
||||||
ORDER BY random()
|
ORDER BY random()
|
||||||
LIMIT 1""")
|
LIMIT 1""")
|
||||||
(id, insult) = cursor.fetchone()
|
(id, insult) = cursor.fetchone()
|
||||||
@ -165,6 +191,15 @@ class FunDB(callbacks.Privmsg):
|
|||||||
self.db.commit()
|
self.db.commit()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.reply(msg, conf.replySuccess)
|
||||||
|
|
||||||
|
def numinsults(self, irc, msg, args):
|
||||||
|
"""takes no arguments
|
||||||
|
|
||||||
|
Returns the number of insults currently in the database"""
|
||||||
|
cursor = self.db.cursor()
|
||||||
|
cursor.execute('SELECT count(*) FROM insults')
|
||||||
|
total = cursor.fetchone()[0]
|
||||||
|
irc.reply(msg, 'There are currently %s insults in my database' % total)
|
||||||
|
|
||||||
def crossword(self, irc, msg, args):
|
def crossword(self, irc, msg, args):
|
||||||
"""<word>
|
"""<word>
|
||||||
|
|
||||||
@ -213,6 +248,15 @@ class FunDB(callbacks.Privmsg):
|
|||||||
self.db.commit()
|
self.db.commit()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.reply(msg, conf.replySuccess)
|
||||||
|
|
||||||
|
def numexcuses(self, irc, msg, args):
|
||||||
|
"""takes no arguments
|
||||||
|
|
||||||
|
Returns the number of excuses currently in the database"""
|
||||||
|
cursor = self.db.cursor()
|
||||||
|
cursor.execute('SELECT count(*) FROM excuses')
|
||||||
|
total = cursor.fetchone()[0]
|
||||||
|
irc.reply(msg, 'There are currently %s excuses in my database' % total)
|
||||||
|
|
||||||
def lart(self, irc, msg, args):
|
def lart(self, irc, msg, args):
|
||||||
"""[<channel>] <nick>
|
"""[<channel>] <nick>
|
||||||
|
|
||||||
@ -261,6 +305,15 @@ class FunDB(callbacks.Privmsg):
|
|||||||
self.db.commit()
|
self.db.commit()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.reply(msg, conf.replySuccess)
|
||||||
|
|
||||||
|
def numlarts(self, irc, msg, args):
|
||||||
|
"""takes no arguments
|
||||||
|
|
||||||
|
Returns the number of larts currently in the database"""
|
||||||
|
cursor = self.db.cursor()
|
||||||
|
cursor.execute('SELECT count(*) FROM larts')
|
||||||
|
total = cursor.fetchone()[0]
|
||||||
|
irc.reply(msg, 'There are currently %s larts in my database' % total)
|
||||||
|
|
||||||
def addword(self, irc, msg, args):
|
def addword(self, irc, msg, args):
|
||||||
"""<word>"""
|
"""<word>"""
|
||||||
word = privmsgs.getArgs(args)
|
word = privmsgs.getArgs(args)
|
||||||
@ -287,33 +340,6 @@ class FunDB(callbacks.Privmsg):
|
|||||||
else:
|
else:
|
||||||
irc.reply(msg, 'That word has no anagrams that I know of.')
|
irc.reply(msg, 'That word has no anagrams that I know of.')
|
||||||
|
|
||||||
def numlarts(self, irc, msg, args):
|
|
||||||
"""<takes no arguments>
|
|
||||||
|
|
||||||
Returns the number of 'larts' currently in the database"""
|
|
||||||
cursor = self.db.cursor()
|
|
||||||
cursor.execute('SELECT count(*) FROM larts')
|
|
||||||
total = cursor.fetchone()[0]
|
|
||||||
irc.reply(msg, 'There are currently %s larts in my database' % total)
|
|
||||||
|
|
||||||
def numinsults(self, irc, msg, args):
|
|
||||||
"""<takes no arguments>
|
|
||||||
|
|
||||||
Returns the number of insults currently in the database"""
|
|
||||||
cursor = self.db.cursor()
|
|
||||||
cursor.execute('SELECT count(*) FROM insults')
|
|
||||||
total = cursor.fetchone()[0]
|
|
||||||
irc.reply(msg, 'There are currently %s insults in my database' % total)
|
|
||||||
|
|
||||||
def numexcuses(self, irc, msg, args):
|
|
||||||
"""<takes no arguments
|
|
||||||
|
|
||||||
Returns the number of excuses currently in the database"""
|
|
||||||
cursor = self.db.cursor()
|
|
||||||
cursor.execute('SELECT count(*) FROM excuses')
|
|
||||||
total = cursor.fetchone()[0]
|
|
||||||
irc.reply(msg, 'There are currently %s excuses in my database' % total)
|
|
||||||
|
|
||||||
Class = FunDB
|
Class = FunDB
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user