Exemple #1
0
 def run(self, bot, params):
     with bot.get_db() as db:
         authorised = is_authorised(db, bot.sender)
     if not authorised:
         logger.warn("Unauthorized attempt to teach a lyric")
         return
     query = 'INSERT INTO sing (lyric) VALUES (?)'
     logger.debug('groups: %s', bot.match.groups())
     lyric = bot.match.groups()[0].strip()
     with bot.get_db() as db:
         db.execute(query, (lyric, ))
     bot.say(bot.target, 'I just learnt: %s' % lyric)
Exemple #2
0
 def run(self, bot, params):
     with bot.get_db() as db:
         authorised = is_authorised(db, bot.sender)
     if not authorised:
         logger.warn("Unauthorized attempt to teach a lyric")
         return
     query = 'INSERT INTO sing (lyric) VALUES (?)'
     logger.debug('groups: %s', bot.match.groups())
     lyric = bot.match.groups()[0].strip()
     with bot.get_db() as db:
         db.execute(query, (lyric,))
     bot.say(bot.target, 'I just learnt: %s' % lyric)
Exemple #3
0
 def run(self, bot, params):
     with bot.get_db() as db:
         authorised = is_authorised(db, bot.sender)
     if not authorised:
         logger.warn("Unauthorized attempt to dump the database")
         return
     sender = bot.sender.split('!', 1)[0]
     logger.info("yt_links:")
     query = 'SELECT * FROM parrot_yt_links'
     yt_links = query_data(bot, query)
     bot.say(sender, '%d links to youtube' % len(yt_links))
     for row in yt_links:
         logger.debug(row.keys())
         logger.info("%d: %s", row['id'], row['link'])
     logger.info("sayings:")
     query = 'SELECT * FROM parrot_sayings'
     sayings = query_data(bot, query)
     bot.say(sender, '%d sayings' % len(sayings))
     for row in sayings:
         logger.info("%d: %s", row['id'], row['saying'])