def message(phenny, input): if not input.sender.startswith('#'): return tellee = input.nick aliases = caseless_list(aliasGroupFor(tellee)) channel = input.sender if not os: return if not os.path.exists(phenny.tell_filename): return reminders = [] remkeys = list(reversed(sorted(phenny.reminders.keys()))) for remkey in remkeys: if not remkey.endswith('*') or remkey.endswith(':'): if remkey.casefold() in aliases: reminders.extend(getReminders(phenny, channel, remkey, tellee)) elif tellee.casefold().startswith(remkey.casefold().rstrip('*:')): reminders.extend(getReminders(phenny, channel, remkey, tellee)) for line in reminders[:maximum]: if "**pm**" in line: line = line.replace("**pm**", "") phenny.msg(tellee, line) else: phenny.say(line) if reminders[maximum:]: phenny.say('Further messages sent privately') for line in reminders[maximum:]: phenny.msg(tellee, line) if len(list(phenny.reminders.keys())) != remkeys: dumpReminders(phenny.tell_filename, phenny.reminders) # @@ tell
def message(phenny, input): if not input.sender.startswith('#'): return tellee = input.nick aliases = caseless_list(aliasGroupFor(tellee)) channel = input.sender reminders = [] remkeys = list(reversed(sorted(phenny.reminders.keys()))) for remkey in remkeys: if not remkey.endswith('*') or remkey.endswith(':'): if remkey.casefold() in aliases: reminders.extend(getReminders(phenny, channel, remkey, tellee)) elif tellee.casefold().startswith(remkey.casefold().rstrip('*:')): reminders.extend(getReminders(phenny, channel, remkey, tellee)) for line in reminders[:maximum]: if "**pm**" in line: line = line.replace("**pm**", "") phenny.msg(tellee, line) else: phenny.say(line) if reminders[maximum:]: phenny.say('Further messages sent privately') for line in reminders[maximum:]: phenny.msg(tellee, line) if len(list(phenny.reminders.keys())) != remkeys: dumpReminders(phenny)
def admin_stop(phenny, input): '''Usage: ".pesters stop <pesterer> to <pesteree>" to stop a pester from <pesterer> to <pesteree>. This functions is for *admins only*.''' admin_stop.conn = sqlite3.connect(phenny.pester_db) c = admin_stop.conn.cursor() if input.nick.casefold() in caseless_list(phenny.config.admins): if c.execute('''SELECT * FROM to_pester WHERE pesteree=? AND pesterer=?''', (input.group(2).casefold(), input.group(1).casefold())).fetchall == []: phenny.say(input.nick + ': ' + input.group(1) + ' is not pestering ' + input.group(2)) else: c.execute('''DELETE FROM to_pester WHERE pesteree=? AND pesterer=?''', (input.group(2).casefold(), input.group(1).casefold())) phenny.say(input.nick + ': ' + input.group(1) + ' is no longer pestering ' + input.group(2)) admin_stop.conn.commit() else: phenny.say('You need to be admin to perform this function.')
def whoisdrop(phenny, input): '''.whoisdrop <nick> - drop a record from the whois database (must be <nick> or a phenny admin)''' try: try: text = input.group().split(' ')[1] except IndexError: phenny.say('usage: .whoisdrop <nick>') return if input.nick.casefold() in caseless_list(phenny.config.admins) or input.nick.lower() is text.lower(): with DatabaseCursor(phenny.whois_db) as cursor: make_table(cursor) cursor.execute('''delete from users where nick = ?;''', (text,)) phenny.say('{} has been removed from the database.'.format(text)) else: phenny.say('You must be an admin to use this command.') except Exception as e: phenny.say('Sorry, an error occurred.') raise e
def admin_stop(phenny, input): '''Usage: ".pesters stop <pesterer> to <pesteree>" to stop a pester from <pesterer> to <pesteree>. This functions is for *admins only*.''' admin_stop.conn = sqlite3.connect(phenny.pester_db) c = admin_stop.conn.cursor() if input.nick.casefold() in caseless_list(phenny.config.admins): if c.execute( '''SELECT * FROM to_pester WHERE pesteree=? AND pesterer=?''', (input.group(2).casefold(), input.group(1).casefold())).fetchall == []: phenny.say(input.nick + ': ' + input.group(1) + ' is not pestering ' + input.group(2)) else: c.execute( '''DELETE FROM to_pester WHERE pesteree=? AND pesterer=?''', (input.group(2).casefold(), input.group(1).casefold())) phenny.say(input.nick + ': ' + input.group(1) + ' is no longer pestering ' + input.group(2)) admin_stop.conn.commit() else: phenny.say('You need to be admin to perform this function.')