def got_someone_said(actor=None, target=None, **kwargs):
    if actor != target:
        commands._do_say(target, "That's not the line! Get off the stage!" )
        if probability(20):
            actor.send("You feel a hard kick from %s on your back." %(target,))
            actor.send_to_others("%s kicks %s off the stage." % (target, actor))
            commands.do_go(actor,  'e')
def got_someone_said(actor=None, target=None, **kwargs):
    if actor != target:
        commands._do_say(target, "That's not the line! Get off the stage!")
        if probability(20):
            actor.send("You feel a hard kick from %s on your back." %
                       (target, ))
            actor.send_to_others("%s kicks %s off the stage." %
                                 (target, actor))
            commands.do_go(actor, 'e')
Exemplo n.º 3
0
def poll_identica(sender, **kwargs):
    global SINCEID
    me = bird()
    last_sinceid = SINCEID
    messages = identica_mentions(SINCEID)
    if SINCEID == 0 and messages:
        messages = messages[-1]
    for msg in identica_mentions(SINCEID):
        SINCEID = msg['id']
        commands._do_say(me, "Bzz Bzz! %s: %s (%s)" %
                         (msg['user']['screen_name'], msg['text'], msg['id']))
Exemplo n.º 4
0
def poll_identica(sender, **kwargs):
    global SINCEID
    me = bird()
    last_sinceid = SINCEID
    messages = identica_mentions(SINCEID)
    if SINCEID == 0 and messages:
        messages = messages[-1]
    for msg in identica_mentions(SINCEID):
        SINCEID = msg['id']
        commands._do_say(
            me, "Bzz Bzz! %s: %s (%s)" %
            (msg['user']['screen_name'], msg['text'], msg['id']))
Exemplo n.º 5
0
def bird():
    return models.Char.objects.get(nick__exact="Bird")


def got_tell(actor=None, target=None, text=None, **kwargs):
    if not settings.IDENTICA_USER:
        commands._do_tell(target, actor, "I tell you nothing!")
        return
    try:
        tid = identica_post('%s: %s' % (actor, text))
    except Exception, e:
        log.error("Exception in bird:", exc_info=True)
        commands._do_tell(target, actor, "I tell you nothing!")
    else:
        commands._do_say(target, "Tweet, tweet! (id=%s)" % (tid, ))


def identica_mentions(since_id):
    if not settings.IDENTICA_USER:
        return []
    resp, content = H.request(
        'https://identi.ca/api/statuses/mentions.json?%s' %
        (urllib.urlencode({'since_id': since_id}), ),
        'GET',
        headers={'cache-control': 'no-cache'})
    try:
        assert resp['status'] == '200'
    except:
        raise
    return list(reversed(json.loads(content)))
Exemplo n.º 6
0
def bird():
    return models.Char.objects.get(nick__exact="Bird")


def got_tell(actor=None, target=None, text=None, **kwargs):
    if not settings.IDENTICA_USER:
        commands._do_tell(target, actor, "I tell you nothing!")
        return
    try:
        tid = identica_post('%s: %s' % (actor, text))
    except Exception, e:
        log.error("Exception in bird:", exc_info=True)
        commands._do_tell(target, actor, "I tell you nothing!")
    else:
        commands._do_say(target, "Tweet, tweet! (id=%s)" % (tid,))


def identica_mentions(since_id):
    if not settings.IDENTICA_USER:
        return []
    resp, content = H.request('https://identi.ca/api/statuses/mentions.json?%s' %
                              (urllib.urlencode({'since_id': since_id}),),
                              'GET',
                              headers={'cache-control':'no-cache'})
    try:
        assert resp['status'] == '200'
    except:
        raise
    return list(reversed(json.loads(content)))