@laamaj.add_on_text def url_handling(connection, msgfrom, target, text): """ Catch url's from messages and store to database. """ if msgfrom in ignorelist: print(u"Ignoring") return for word in text.split(): if re.search(u"\Ahttps?://.*", word): # Fetch title and post to channel title = get_url_title(word) if title: mess = u"< %s >" % (title) mess = mess.encode("ascii", "replace") connection.send_msg(target, mess) # Add website to database res, out = db.add_website(msgfrom, target, word) print(res, out) # removed because of Gary tears # post to channel if url is a repost # if res == u'repost': # msg = u'{0}: The cycle continues...'.format(msgfrom) # connection.send_msg(target, msg) laamaj.connect() laamaj.process()