mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-11 12:42:34 +01:00
Changed the name of the quote command to get.
This commit is contained in:
parent
cc94948d10
commit
66797de4bf
@ -48,7 +48,7 @@ import ircdb
|
|||||||
import privmsgs
|
import privmsgs
|
||||||
import callbacks
|
import callbacks
|
||||||
|
|
||||||
class Quotes(plugins.ChannelDBHandler, callbacks.Privmsg):
|
class Quotes(plugins.ChannelDBHandler, callbacks.Privmsg, plugins.Toggleable):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
plugins.ChannelDBHandler.__init__(self)
|
plugins.ChannelDBHandler.__init__(self)
|
||||||
callbacks.Privmsg.__init__(self)
|
callbacks.Privmsg.__init__(self)
|
||||||
@ -69,7 +69,9 @@ class Quotes(plugins.ChannelDBHandler, callbacks.Privmsg):
|
|||||||
cursor.execute("""CREATE TABLE quotegrabs (
|
cursor.execute("""CREATE TABLE quotegrabs (
|
||||||
id INTEGER PRIMARY KEY,
|
id INTEGER PRIMARY KEY,
|
||||||
nick TEXT,
|
nick TEXT,
|
||||||
|
hostmask TEXT,
|
||||||
added_by TEXT,
|
added_by TEXT,
|
||||||
|
added_at TIMESTAMP,
|
||||||
quote TEXT
|
quote TEXT
|
||||||
);""")
|
);""")
|
||||||
db.commit()
|
db.commit()
|
||||||
@ -114,7 +116,7 @@ class Quotes(plugins.ChannelDBHandler, callbacks.Privmsg):
|
|||||||
s = 'There %s %s %s in my database.' % (utils.be(maxid), maxid, QUOTE)
|
s = 'There %s %s %s in my database.' % (utils.be(maxid), maxid, QUOTE)
|
||||||
irc.reply(msg, s)
|
irc.reply(msg, s)
|
||||||
|
|
||||||
def quote(self, irc, msg, args):
|
def get(self, irc, msg, args):
|
||||||
"""[<channel>] --{id,regexp,from,with}=<value> ]
|
"""[<channel>] --{id,regexp,from,with}=<value> ]
|
||||||
|
|
||||||
Returns quote(s) matching the given criteria. --from is who added the
|
Returns quote(s) matching the given criteria. --from is who added the
|
||||||
@ -205,7 +207,7 @@ class Quotes(plugins.ChannelDBHandler, callbacks.Privmsg):
|
|||||||
irc.error(msg, 'It seems that quote database is empty.')
|
irc.error(msg, 'It seems that quote database is empty.')
|
||||||
return
|
return
|
||||||
(id,) = cursor.fetchone()
|
(id,) = cursor.fetchone()
|
||||||
self.quote(irc, msg, [channel, '--id', str(id)])
|
self.get(irc, msg, [channel, '--id', str(id)])
|
||||||
|
|
||||||
def info(self, irc, msg, args):
|
def info(self, irc, msg, args):
|
||||||
"""[<channel>] <id>
|
"""[<channel>] <id>
|
||||||
|
@ -43,23 +43,23 @@ if sqlite is not None:
|
|||||||
self.assertRegexp('num #foo', '0')
|
self.assertRegexp('num #foo', '0')
|
||||||
self.assertRegexp('add #foo foo', 'Quote #1 added')
|
self.assertRegexp('add #foo foo', 'Quote #1 added')
|
||||||
self.assertRegexp('num #foo', '1')
|
self.assertRegexp('num #foo', '1')
|
||||||
self.assertResponse('quote #foo --id 1', '#1: foo')
|
self.assertResponse('get #foo --id 1', '#1: foo')
|
||||||
self.assertResponse('quote #foo 1', '#1: foo')
|
self.assertResponse('get #foo 1', '#1: foo')
|
||||||
self.assertRegexp('add #foo bar','Quote #2 added')
|
self.assertRegexp('add #foo bar','Quote #2 added')
|
||||||
self.assertResponse('quote #foo 2', '#2: bar')
|
self.assertResponse('get #foo 2', '#2: bar')
|
||||||
self.assertResponse('quote #foo --id 2', '#2: bar')
|
self.assertResponse('get #foo --id 2', '#2: bar')
|
||||||
self.assertRegexp('add #foo baz','Quote #3 added')
|
self.assertRegexp('add #foo baz','Quote #3 added')
|
||||||
self.assertRegexp('num #foo', '3')
|
self.assertRegexp('num #foo', '3')
|
||||||
self.assertResponse('quote #foo 3', '#3: baz')
|
self.assertResponse('get #foo 3', '#3: baz')
|
||||||
self.assertRegexp('quote #foo --regexp m/ba/', 'bar.*baz')
|
self.assertRegexp('get #foo --regexp m/ba/', 'bar.*baz')
|
||||||
self.assertRegexp('quote #foo --regexp ba', 'bar.*baz')
|
self.assertRegexp('get #foo --regexp ba', 'bar.*baz')
|
||||||
self.assertRegexp('quote #foo --with bar', '#2: bar')
|
self.assertRegexp('get #foo --with bar', '#2: bar')
|
||||||
self.assertRegexp('quote #foo bar', '#2: bar')
|
self.assertRegexp('get #foo bar', '#2: bar')
|
||||||
self.assertNotError('info #foo 1')
|
self.assertNotError('info #foo 1')
|
||||||
self.assertNotError('random #foo')
|
self.assertNotError('random #foo')
|
||||||
self.assertError('remove #foo 4')
|
self.assertError('remove #foo 4')
|
||||||
self.assertError('info #foo 4')
|
self.assertError('info #foo 4')
|
||||||
self.assertNotError('quote #foo 3')
|
self.assertNotError('get #foo 3')
|
||||||
self.assertNotError('remove #foo 3')
|
self.assertNotError('remove #foo 3')
|
||||||
self.assertRegexp('num #foo', '2')
|
self.assertRegexp('num #foo', '2')
|
||||||
self.assertNotError('remove #foo 1')
|
self.assertNotError('remove #foo 1')
|
||||||
|
Loading…
Reference in New Issue
Block a user