mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-14 14:49:21 +01:00
Quote: add 'replace' command
This commit is contained in:
parent
f4425de7c5
commit
93d94067d0
@ -48,6 +48,21 @@ class Quote(plugins.ChannelIdDatabasePlugin):
|
||||
irc.error(_('I have no quotes in my database for %s.') % channel)
|
||||
random = wrap(random, ['channeldb'])
|
||||
|
||||
def replace(self, irc, msg, args, user, channel, id, text):
|
||||
"""[<channel>] <id> <text>
|
||||
Replace quote <id> with <text>. <channel> is only necessary if
|
||||
the message isn't sent in the channel itself.
|
||||
"""
|
||||
try:
|
||||
record = self.db.get(channel, id)
|
||||
self.checkChangeAllowed(irc, msg, channel, user, record)
|
||||
record.text = text
|
||||
self.db.set(channel, id, record)
|
||||
irc.replySuccess()
|
||||
except KeyError:
|
||||
self.noSuchRecord(irc, channel, id)
|
||||
replace = wrap(replace, ['user', 'channeldb', 'id', 'text'])
|
||||
|
||||
Class = Quote
|
||||
|
||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
||||
|
Loading…
Reference in New Issue
Block a user