Changed the name of the quote command to get.

This commit is contained in:
Jeremy Fincher 2003-11-03 06:36:18 +00:00
parent cc94948d10
commit 66797de4bf
2 changed files with 15 additions and 13 deletions

View File

@ -48,7 +48,7 @@ import ircdb
import privmsgs
import callbacks
class Quotes(plugins.ChannelDBHandler, callbacks.Privmsg):
class Quotes(plugins.ChannelDBHandler, callbacks.Privmsg, plugins.Toggleable):
def __init__(self):
plugins.ChannelDBHandler.__init__(self)
callbacks.Privmsg.__init__(self)
@ -69,7 +69,9 @@ class Quotes(plugins.ChannelDBHandler, callbacks.Privmsg):
cursor.execute("""CREATE TABLE quotegrabs (
id INTEGER PRIMARY KEY,
nick TEXT,
hostmask TEXT,
added_by TEXT,
added_at TIMESTAMP,
quote TEXT
);""")
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)
irc.reply(msg, s)
def quote(self, irc, msg, args):
def get(self, irc, msg, args):
"""[<channel>] --{id,regexp,from,with}=<value> ]
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.')
return
(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):
"""[<channel>] <id>

View File

@ -43,23 +43,23 @@ if sqlite is not None:
self.assertRegexp('num #foo', '0')
self.assertRegexp('add #foo foo', 'Quote #1 added')
self.assertRegexp('num #foo', '1')
self.assertResponse('quote #foo --id 1', '#1: foo')
self.assertResponse('quote #foo 1', '#1: foo')
self.assertResponse('get #foo --id 1', '#1: foo')
self.assertResponse('get #foo 1', '#1: foo')
self.assertRegexp('add #foo bar','Quote #2 added')
self.assertResponse('quote #foo 2', '#2: bar')
self.assertResponse('quote #foo --id 2', '#2: bar')
self.assertResponse('get #foo 2', '#2: bar')
self.assertResponse('get #foo --id 2', '#2: bar')
self.assertRegexp('add #foo baz','Quote #3 added')
self.assertRegexp('num #foo', '3')
self.assertResponse('quote #foo 3', '#3: baz')
self.assertRegexp('quote #foo --regexp m/ba/', 'bar.*baz')
self.assertRegexp('quote #foo --regexp ba', 'bar.*baz')
self.assertRegexp('quote #foo --with bar', '#2: bar')
self.assertRegexp('quote #foo bar', '#2: bar')
self.assertResponse('get #foo 3', '#3: baz')
self.assertRegexp('get #foo --regexp m/ba/', 'bar.*baz')
self.assertRegexp('get #foo --regexp ba', 'bar.*baz')
self.assertRegexp('get #foo --with bar', '#2: bar')
self.assertRegexp('get #foo bar', '#2: bar')
self.assertNotError('info #foo 1')
self.assertNotError('random #foo')
self.assertError('remove #foo 4')
self.assertError('info #foo 4')
self.assertNotError('quote #foo 3')
self.assertNotError('get #foo 3')
self.assertNotError('remove #foo 3')
self.assertRegexp('num #foo', '2')
self.assertNotError('remove #foo 1')