Beispiel #1
0
def b_user(id, msg, lis):

    if not (id in user.users()):

        user.add_user(id, '')
        lis[id] = user(id)

        #userlis[id] = user (id)

    ituser = lis[id]
    imd = ituser.mode

    if ituser.name == '' and ituser.mode == '0':
        ituser.smode('name')

    elif ituser.mode == 'name2':
        ituser.set_name(msg)
        ituser.smode('name3')

    elif imd == 'rename2':
        ituser.set_name(msg)
        ituser.smode('rename3')

    elif ituser.mode == 'name':

        send_message({
            "to":
            id,
            "type":
            "TEXT",
            "body":
            "واقعا بابت تصمیمت خوشحال شدم(گرچه همه زحمتا با منه;)\nراستی اسمتو نگفتی!؟"
        })
        ituser.smode('name2')
Beispiel #2
0
def massage():

    for input in massages():

        b_user(input['from'], input['body'], ulist)
        barr(input['from'], input['body'], ulist)
        if ulist[input['from']].ready == 'True':
            if '///' in input['body']:
                user_control(input['from'], input['body'])
        #print (str(input) + ulist [input ['from']].name)

        it = ulist[input['from']]
        if ulist[input['from']].mode == 'block':

            send_message({
                'type': 'TEXT',
                'body': 'برو کار دارم',
                'to': input['from']
            })

        elif input['body'] == 'admin' or "admin" in it.mode:

            if it.id == dmn():

                it.lmsg = input['body']
                admin2(ulist)

            else:

                try:
                    it.wait()
                except:
                    pass

                send_message({'body': 'چی میگی؟؟', 'to': input['from']})

        elif it.mode == 'chat':

            it.lmsg = input['body']
            moe = chat(it, ulist[it.chat])

            if moe == '//End':

                it.lmsg = input['body']
                admin2(ulist)

        else:

            yield ((input['from'], input['body']))
Beispiel #3
0
def stalker():
    if request.form.get('token') == SLACK_SLASH_SECRET_SCAN:
        # channel = request.form.get('channel_name')
        username = request.form.get('user_name')
        text = request.form.get('text')
        # inbound_message = username + " in " + channel + " says: " + text
        # print(inbound_message)
        print("Invoking Stalker...")
        # Response(), 200      
        if(not try_parse_message_poll(text)):
            core.send_message( "@" + username, "Bad request! Syntax is: " + request.form.get('command') + " \"Address\" \"Comma,separated,list,of,pokemon\" -- including quotes!") 
        else:
            core.send_message( "@" + username, "Kicking off a pokemon poll for one hour for: "+ text) 
            q = mp.Queue()
            p = mp.Process(target=longtask, args=(username, True, shlex.split(unidecode(text))[0],shlex.split(unidecode(text))[1].lower().split(","),))
            p.start()
            print("Kicked background action to poke-poll!")
        # core.stalk_core(text) 
        # Make this do poke-poll for an hour, responding to me.  
    return Response(), 200
Beispiel #4
0
def pollOnce():
    if request.form.get('token') == SLACK_SLASH_SECRET_PULSE:
        # channel = request.form.get('channel_name')
        username = request.form.get('user_name')
        text = request.form.get('text')
        # inbound_message = username + " in " + channel + " says: " + text
        # print(inbound_message)
        print("Invoking scan once...")
        # Response(), 200      
        if(not try_parse_message_pulse(text)):
            core.send_message( "@" + username, "Bad request! Syntax is: " + request.form.get('command') + " \"Address\" -- including quotes!") 
        else:
            core.send_message( "@" + username, "Kicking off a single-sweep for all pokemon near: "+ text) 
            q = mp.Queue()
            list_all_poke = "Bulbasaur,Ivysaur,Venusaur,Charmander,Charmeleon,Charizard,Squirtle,Wartortle,Blastoise,Caterpie,Metapod,Butterfree,Weedle,Kakuna,Beedrill,Pidgey,Pidgeotto,Pidgeot,Rattata,Raticate,Spearow,Fearow,Ekans,Arbok,Pikachu,Raichu,Sandshrew,Sandslash,NidoranF,Nidorina,Nidoqueen,NidoranM,Nidorino,Nidoking,Clefairy,Clefable,Vulpix,Ninetales,Jigglypuff,Wigglytuff,Zubat,Golbat,Oddish,Gloom,Vileplume,Paras,Parasect,Venonat,Venomoth,Diglett,Dugtrio,Meowth,Persian,Psyduck,Golduck,Mankey,Primeape,Growlithe,Arcanine,Poliwag,Poliwhirl,Poliwrath,Abra,Kadabra,Alakazam,Machop,Machoke,Machamp,Bellsprout,Weepinbell,Victreebell,Tentacool,Tentacruel,Geodude,Graveler,Golum,Ponyta,Rapidash,Slowpoke,Slowbro,Magnemite,Magneton,Farfetch'd,Doduo,Dodrio,Seel,Dewgong,Grimer,Muk,Shellder,Cloyster,Gastly,Haunter,Gengar,Onix,Drowzee,Hypno,Krabby,Kingler,Voltorb,Electrode,Exeggcute,Exeggutor,Cubone,Marowak,Hitmonlee,Hitmonchan,Lickitung,Koffing,Weezing,Rhyhorn,Rhydon,Chansey,Tangela,Kangaskhan,Horsea,Seadra,Goldeen,Seaking,Staryu,Starmie,MrMime,Scyther,Jynx,Electabuzz,Magmar,Pinsir,Tauros,Magikarp,Gyarados,Lapras,Ditto,Eevee,Vaporeon,Jolteon,Flareon,Porygon,Omanyte,Omastar,Kabuto,Kabutops,Aerodactyl,Snorlax,Articuno,Zapdos,Moltres,Dratini,Dragonair,Dragonite,Mewtwo,Mew"
            p = mp.Process(target=longtask, args=(username, False, text, list_all_poke.lower().split(","),))
            p.start()
            print("Kicked background action to poke-poll!")
        # core.stalk_core(text) 
        # Make this do poke-poll for an hour, responding to me.  
    return Response(), 200
Beispiel #5
0
def barr(id, text, ulist):

    it = ulist[id]
    imode = it.mode
    # select box

    if imode == 'name4':

        if text == 'False':
            sen = "شرمنده): حالا زحمتت یه بار بگو باید بیشتر حواسمو جمع کنم"
            it.smode('rename2')
        elif text == 'True':
            send_message({'body': 'خب خدا رو شکر', 'type': 'TEXT', 'to': id})
            sen = "راستی کلماتی که من بلدم معمولا معنیاشون اشتباست اگه اشتباه بود درستشون رو برام بفرست"
            it.smode('start')
        else:
            sen = 'جان؟؟؟'

        send_message({'type': 'TEXT', 'body': sen, 'to': id})

    elif imode == 'rename4':

        if text == 'False':
            sen = "کم کم دارم احساس میکنم که مشکل از من نیست(:\n یا سر کارم گذاشتی!!!"
            send_message({'type': 'TEXT', 'body': sen, 'to': id})
            sen = 'حالا عیب نداره یه بار دیگه اسمتو بگو'
            it.smode('rename2')
        elif text == 'True':
            send_message({'body': 'خب خدا رو شکر', 'type': 'TEXT', 'to': id})
            sen = "راستی کلماتی که من بلدم معمولا معنیاشون اشتباست اگه اشتباه بود درستشون رو برام بفرست"
            it.smode('start')
        else:
            sen = 'جان؟؟؟'

        send_message({'type': 'TEXT', 'body': sen, 'to': id})

    elif imode == 'name3':

        key = [[{
            'command': 'True',
            'text': 'آره درسته'
        }, {
            'text': 'نه بابا اشتباه شد',
            'command': 'False'
        }]]
        sen = "عالی شد ،%s (اسمتو درست گفتم؟) خب حالا بیا شروع کنیم " % it.name

        send_message({"to": id, "type": "TEXT", "body": sen, "keyboard": key})
        it.smode('name4')

    elif imode == 'rename3':
        sen = 'امیدوارم این دفعه اشتباه نشده باشه خب بزار.........\n اسمت %s شد دیگه درسنه؟' % it.name
        key = [[{
            'text': 'مثل اینکه دوباره اشتباه شده!!!',
            'command': 'False'
        }, {
            'command': 'True',
            'text': 'خدارو شکر درسته'
        }]]
        send_message({"to": id, "type": "TEXT", "body": sen, "keyboard": key})
        it.smode('rename4')