示例#1
0
def send_not_valid(user):
    print(user)
    pzgram.Chat(user, bot).send(
        "Ho rilevato che i dati inseiriti non sono piu corretti\nNel caso tu non abbia fatto nessuna modifica contatta @infopz",
        no_keyboard=True)
    pzgram.Chat(user, bot).send("Inserisci il tuo username/email",
                                no_keyboard=True)
    sql_functions.change_status('start1', user)
示例#2
0
文件: ipBot.py 项目: paxet/pzgram
def check_for_changes():
    global old_ip
    new_ip = get_my_ip()
    if old_ip == "not_set":
        pzgram.Chat(bot, adminId).send("Il tuo ip e' " + new_ip)
        old_ip = new_ip
    elif new_ip != old_ip:
        messaggio = "Il tuo ip e' cambiato\nQuello nuovo e': " + new_ip
        pzgram.Chat(bot, adminId).send(messaggio)
        old_ip = new_ip
示例#3
0
def check_torrent():
    torrents = transmission.get_torrent_status()
    for t in torrents:
        completed = 1 if t["perc"] == "100%" else 0
        d = db.get_torrent(t["name"])
        if d is None:
            db.add_torrent(t["name"], completed)
            if completed:
                pzgram.Chat(bot, ownerId).send("💯 Il download di *\n" + t["name"] + "\n* e' stato completato",
                                               parse_mode="markdown")

        elif completed and d[1] == 0:
            db.torrent_completed(t['name'])
            pzgram.Chat(bot, ownerId).send("💯 Il download di *\n" + t["name"] + "\n* e' stato completato",
                                           parse_mode="markdown")
示例#4
0
def allert_timer(bot, shared):
    h = int(datetime.now().strftime('%H'))
    if h == 14:
        print("Timer 14")
        s = useful_function.check_tomorrow()
        if s != '':
            pzgram.Chat(20403805, bot).send(s)
            pzgram.Chat("@schoolDiary5FInfopz", bot).send(s, reply_markup="")
    elif h == 20:
        print("Timer 20")
        tomorrow = int((datetime.now()+timedelta(days=1)).strftime('%u')) - 1
        if tomorrow != 6:
            times = shared['times']
            subjects = times['days'][tomorrow]['subjects']
            m = ''
            for n, s in enumerate(subjects, start=1):
                m += str(n) + ' ' + s + '\n'
            pzgram.Chat(20403805, bot).send("Dear Egg\nHere's your subjects for tomorrow")
            pzgram.Chat(20403805, bot).send(m)
            pzgram.Chat("@schoolDiary5FInfopz", bot).send(m, reply_markup="")
示例#5
0
def check_new():
    feed = rss.check_rss()
    torrent = rss.analyze_feed(feed)
    if len(torrent):
        for t in torrent:
            s = t["size"].split()
            if s[1] == "MB":
                continue
            text = "Name: " + t["title"] + "\nSize: " + t["size"]
            keyboard = [[pzgram.create_button("✅ Scarica", data="num_" + str(t["number"])),
                         pzgram.create_button("❌ Cancella", data="del")]]
            keyboard = pzgram.create_inline(keyboard)
            pzgram.Chat(bot, ownerId).send(text, reply_markup=keyboard)
示例#6
0
def check_vote():
    users = sql_functions.get_user_list()
    toRemove = list()
    for u in users:
        m = "Ehi, hai nuovi voti:\n"
        nuovi_voti = check_new_vote(u)
        if nuovi_voti == False:
            continue
        if len(nuovi_voti) == 0:
            continue
        for g in nuovi_voti:
            m += f"{g['subjectDesc']}\n*{g['decimalValue']}* - {g['evtDate']}\n"
        if m != "Ehi, hai nuovi voti:\n":
            r = pzgram.Chat(u[0], bot).send(m)
            if str(r).endswith("403"):  # USER BLOCK BOT
                toRemove.append(u[0])
            print("NEWVOTE " + str(u[0]))
        time.sleep(2)
    for r in toRemove:
        sql_functions.delete_user(r)
        print("User " + str(r) + " removed")