def showtells(context): '.showtells -- view all pending tell messages (sent in PM).' nick = context.line['user'] db = get_db_connection() db_init(db) tells = get_tells(db, nick) if not tells: bot.reply('You have no pending tells.', context, recipient=nick, notice=True) return for tell in tells: user_from, message, time, chan = tell past = timesince(time) bot.reply('{0} said {1} ago in {2}: {3}'.format( user_from, past, chan, message), context, recipient=nick, notice=True) db.execute('delete from tell where user_to=lower(?)', (nick, )) db.commit()
def tellinput(context): if "showtells" in context.line["message"].lower(): return nick = context.line["user"] db = get_db_connection() db_init(db) tells = get_tells(db, nick) if tells: user_from, message, time, chan = tells[0] past = timesince(time) reply = "{0} said {1} ago in {2}: {3}".format(user_from, past, chan, message) if len(tells) > 1: reply += " (+{0} more, .showtells to view)".format((len(tells) - 1)) db.execute("delete from tell where user_to=lower(?) and message=?", (nick, message)) db.commit() return reply
def showtells(context): ".showtells -- view all pending tell messages (sent in PM)." nick = context.line["user"] db = get_db_connection() db_init(db) tells = get_tells(db, nick) if not tells: bot.reply("You have no pending tells.", context, recipient=nick, notice=True) return for tell in tells: user_from, message, time, chan = tell past = timesince(time) bot.reply( "{0} said {1} ago in {2}: {3}".format(user_from, past, chan, message), context, recipient=nick, notice=True ) db.execute("delete from tell where user_to=lower(?)", (nick,)) db.commit()
def tellinput(context): if 'showtells' in context.line['message'].lower(): return nick = context.line['user'] db = get_db_connection() db_init(db) tells = get_tells(db, nick) if tells: user_from, message, time, chan = tells[0] past = timesince(time) reply = '{0} said {1} ago in {2}: {3}'.format(user_from, past, chan, message) if len(tells) > 1: reply += \ ' (+{0} more, .showtells to view)'.format((len(tells) - 1)) db.execute('delete from tell where user_to=lower(?) and message=?', (nick, message)) db.commit() return reply