def _apicall(self, irc, cmd, **kwds): data = qdbapi.apicall(cmd, **kwds) if not data: irc.reply('(none)') return if isinstance(data,str): irc.reply(data) return if isinstance(data,list): q = qdbapi.format_quote_list(data) else: q = qdbapi.format_quote(data) irc.reply(q, prefixNick=False) return
def add(self, irc, msg, args, quote): '''<quote> Add the quote to the database. It is best to type "<nick>" before a line to indicate the speaker. Lines can be separated with the bar "|" symbol.''' print 'ADD',quote quote = ' '.join(quote) quote = qdbapi.wash_quote(quote) data = qdbapi.apicall('add', quote=quote) try: idn = data['id'] except IndexError: irc.reply('Did not get a quote ID# back, server crapped out: %s' % \ qdbapi.rashurl) return irc.reply('Added quote #%s' % data['id'], prefixNick=False) return