Пример #1
0
def twittercb(bot, event):
    event.dontbind = False
    event.bind(force=True)
    try: twittername = event.chan.data.twittername
    except Exception as ex: handle_exception() ; twittername = None
    try: username = event.origin ; logging.info("using origin %s" % event.origin)
    except Exception as ex: handle_exception() ; username = None
    if twittername:
        try: twitter_out(twittername or username or "tl", event.txt, event)
        except Exception as ex: logging.warn("error posting to twitter: %s" % str(ex))
Пример #2
0
def handle_twitter(bot, ievent):
    """ arguments: <txt> - send a twitter message. """
    go = getauth()
    if not go: ievent.reply("the twitter plugin needs the credentials.py file in the .tl/config dir. see the examples directory") ; return
    txt = ievent.rest
    if ievent.ispipelined:
        txt = ievent.wait()
    if not txt: ievent.missing('<txt>') ; return
    else:
        if ievent.chan:
            taglist = ievent.chan.data.taglist
            if taglist:
                for tag in taglist:
                   txt += " %s" % tag
        twitter_out(ievent.user.data.name, txt, ievent) ; ievent.reply("tweet posted")