コード例 #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)
コード例 #2
0
ファイル: jiggly.py プロジェクト: piotrhajduga/ScytheBot
 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)
コード例 #3
0
ファイル: parrot.py プロジェクト: piotrhajduga/ScytheBot
 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'])