Example #1
0
def add_to_list(keywoard, group_id):
    with PETERCORDGLOBALLIST_INSERTION_LOCK:
        broadcast_group = PetercordGloballist(keywoard, str(group_id))
        SESSION.merge(broadcast_group)
        SESSION.commit()
        GLOBALLIST_SQL_.GLOBALLIST_VALUES.setdefault(keywoard,
                                                     set()).add(str(group_id))
Example #2
0
def add_to_blacklist(chat_id, trigger):
    with BLACKLIST_FILTER_INSERTION_LOCK:
        blacklist_filt = BlackListFilters(str(chat_id), trigger)

        SESSION.merge(blacklist_filt)  # merge to avoid duplicate key issues
        SESSION.commit()
        CHAT_BLACKLISTS.setdefault(str(chat_id), set()).add(trigger)
Example #3
0
def add_to_broadcastlist(keywoard, group_id):
    with CATBROADCAST_INSERTION_LOCK:
        broadcast_group = CatBroadcast(keywoard, str(group_id))

        SESSION.merge(broadcast_group)
        SESSION.commit()
        BROADCAST_SQL_.BROADCAST_CHANNELS.setdefault(keywoard,
                                                     set()).add(str(group_id))
Example #4
0
def toplu_sil_warn(userid):
    try:
        uyari = Warns(userid, 0)
        SESSION.merge(uyari)
        SESSION.commit()
    except:
        return False
    return True
Example #5
0
def add_to_collectionlist(keywoard, contents):
    with PETERCORD_GLOBALCOLLECTION:
        keyword_items = Petercord_GlobalCollection(keywoard, tuple(contents))

        SESSION.merge(keyword_items)
        SESSION.commit()
        COLLECTION_SQL_.CONTENTS_LIST.setdefault(keywoard,
                                                 set()).add(tuple(contents))
Example #6
0
def ekle_mesaj(komut, mesaj):
    with KOMUT_INSERTION_LOCK:
        try:
            SESSION.query(Mesajlar).filter(Mesajlar.komut == komut).delete()
        except:
            pass

        komut = Mesajlar(komut, mesaj)
        SESSION.merge(komut)
        SESSION.commit()
Example #7
0
def ekle_foto(foto):
    with KOMUT_INSERTION_LOCK:
        try:
            SESSION.query(Galeri).filter(Galeri.foto == foto).delete()
        except:
            pass

        ekleme = Galeri(foto)
        SESSION.merge(ekleme)
        SESSION.commit()
Example #8
0
def ekle_warn(userid):
    with KOMUT_INSERTION_LOCK:
        try:
            UYARI = SESSION.query(Warns).filter(Warns.user_id == userid).first()
            wsayi = int(UYARI.num_warn)
            SESSION.query(Warns).filter(Warns.user_id == userid).delete()
        except:
            wsayi =  0

        wsayi += 1
        komut = Warns(userid, wsayi)
        SESSION.merge(komut)
        SESSION.commit()
Example #9
0
def sil_warn(userid):
    try:
        wsayi = SESSION.query(Warns).filter(Warns.user_id == userid).first().num_warn
        if wsayi == 0:
            return False
        nsayi = wsayi - 1
        SESSION.query(Warns).filter(Warns.user_id == userid).delete()

        uyari = Warns(userid, nsayi)
        SESSION.merge(uyari)
        SESSION.commit()
        return True
    except:
        return False
    return True