コード例 #1
0
ファイル: globals.py プロジェクト: DARKLONX/DARKLONX
def addgvar(variable, value):
    if SESSION.query(Globals).filter(
            Globals.variable == str(variable)).one_or_none():
        delgvar(variable)
    adder = Globals(str(variable), value)
    SESSION.add(adder)
    SESSION.commit()
コード例 #2
0
def add_channel(chat_id, channel):
    adder = SESSION.query(forceSubscribe).get(chat_id)
    if adder:
        adder.channel = channel
    else:
        adder = forceSubscribe(chat_id, channel)
    SESSION.add(adder)
    SESSION.commit()
コード例 #3
0
def init_locks(chat_id, reset=False):
    curr_restr = SESSION.query(Locks).get(str(chat_id))
    if reset:
        SESSION.delete(curr_restr)
        SESSION.flush()
    restr = Locks(str(chat_id))
    SESSION.add(restr)
    SESSION.commit()
    return restr
コード例 #4
0
ファイル: antiflood_sql.py プロジェクト: DARKLONX/DARKLONX
def set_flood(chat_id, amount):
    with INSERTION_LOCK:
        flood = SESSION.query(FloodControl).get(str(chat_id))
        if not flood:
            flood = FloodControl(str(chat_id))

        flood.user_id = None
        flood.limit = amount

        CHAT_FLOOD[str(chat_id)] = (None, DEF_COUNT, amount)

        SESSION.add(flood)
        SESSION.commit()
コード例 #5
0
def addwafu_setting(chat_id, previous_wafu, reply, f_mesg_id):
    to_check = getwafu(chat_id)
    if not to_check:
        adder = Joinwafu(chat_id, previous_wafu, reply, f_mesg_id)
        SESSION.add(adder)
        SESSION.commit()
        return True
    rem = SESSION.query(Joinwafu).get(str(chat_id))
    SESSION.delete(rem)
    SESSION.commit()
    adder = Joinwafu(chat_id, previous_wafu, reply, f_mesg_id)
    SESSION.commit()
    return False
コード例 #6
0
def add_filter(chat_id, keyword, reply, snip_type, media_id, media_access_hash,
               media_file_reference):
    adder = SESSION.query(Filters).get((str(chat_id), keyword))
    if adder:
        adder.reply = reply
        adder.snip_type = snip_type
        adder.media_id = media_id
        adder.media_access_hash = media_access_hash
        adder.media_file_reference = media_file_reference
    else:
        adder = Filters(chat_id, keyword, reply, snip_type, media_id,
                        media_access_hash, media_file_reference)
    SESSION.add(adder)
    SESSION.commit()
コード例 #7
0
def add_snip(keyword, reply, snip_type, media_id, media_access_hash,
             media_file_reference):
    adder = SESSION.query(Snips).get(keyword)
    if adder:
        adder.reply = reply
        adder.snip_type = snip_type
        adder.media_id = media_id
        adder.media_access_hash = media_access_hash
        adder.media_file_reference = media_file_reference
    else:
        adder = Snips(keyword, reply, snip_type, media_id, media_access_hash,
                      media_file_reference)
    SESSION.add(adder)
    SESSION.commit()
コード例 #8
0
def update_lock(chat_id, lock_type, locked):
    curr_perm = SESSION.query(Locks).get(str(chat_id))
    if not curr_perm:
        curr_perm = init_locks(chat_id)
    if lock_type == "bots":
        curr_perm.bots = locked
    elif lock_type == "commands":
        curr_perm.commands = locked
    elif lock_type == "email":
        curr_perm.email = locked
    elif lock_type == "forward":
        curr_perm.forward = locked
    elif lock_type == "url":
        curr_perm.url = locked
    SESSION.add(curr_perm)
    SESSION.commit()
コード例 #9
0
ファイル: welcome_sql.py プロジェクト: DARKLONX/DARKLONX
def add_welcome_setting(
    chat_id,
    custom_welcome_message,
    should_clean_welcome,
    previous_welcome,
    media_file_id
):
    # adder = SESSION.query(Welcome).get(chat_id)
    adder = Welcome(
        chat_id,
        custom_welcome_message,
        should_clean_welcome,
        previous_welcome,
        media_file_id
    )
    SESSION.add(adder)
    SESSION.commit()
コード例 #10
0
ファイル: mute_sql.py プロジェクト: DARKLONX/DARKLONX
def mute(sender, chat_id):
    adder = Mute(str(sender), str(chat_id))
    SESSION.add(adder)
    SESSION.commit()
コード例 #11
0
ファイル: pmpermit_sql.py プロジェクト: DARKLONX/DARKLONX
def approve(chat_id, reason):
    adder = PMPermit(str(chat_id), str(reason))
    SESSION.add(adder)
    SESSION.commit()
コード例 #12
0
def addecho(user_id, chat_id):
    adder = ECHOSQL(str(user_id), str(chat_id))
    SESSION.add(adder)
    SESSION.commit()
コード例 #13
0
def add_usersid_in_db(chat_id: int):
    id_user = Moidata(str(chat_id))
    SESSION.add(id_user)
    SESSION.commit()
コード例 #14
0
def gmute(sender):
    adder = GMute(str(sender))
    SESSION.add(adder)
    SESSION.commit()
コード例 #15
0
def add_flist(chat_id, fed_name):
    adder = Fban(str(chat_id), fed_name)
    SESSION.add(adder)
    SESSION.commit()
コード例 #16
0
def approve(chat_id):
    adder = NOLogPMs(chat_id)
    SESSION.add(adder)
    SESSION.commit()
コード例 #17
0
ファイル: gban_sql_helper.py プロジェクト: DARKLONX/DARKLONX
def catgban(chat_id, reason):
    adder = GBan(str(chat_id), str(reason))
    SESSION.add(adder)
    SESSION.commit()