예제 #1
0
async def add_to_blacklist(chat_id, trigger):
    to_check = await check_blacklist(chat_id, trigger)
    if not to_check:
        cli.insert_one({'chat_id': chat_id, 'trigger': trigger})
        return True
    else:
        cli.update_one(
            {
                '_id': to_check["_id"],
                'chat_id': to_check["chat_id"],
                'trigger': to_check["trigger"],
            }, {"$set": {
                'trigger': trigger
            }})
        return False
예제 #2
0
async def mute_chat(mute_e):
    from database.mongo import cli
    cli = cli["Userbot"]["mute_chat"]
    """ For .mutechat command, mute any chat. """
    await mute_e.edit(str(mute_e.chat_id))
    cli.insert_one({"chat_id": mute_e.chat_id})
    user = await get_user_from_id(mute_e.sender_id, mute_e)
    await mute_e.edit("`Shush! This chat will be silenced!`")
    if ENABLE_LOG:
        await mute_e.client.send_message(
            LOGGING_CHATID,
            "#CHAT_MUTE\n"
            f"USER: [{user.first_name}](tg://user?id={user.id})\n"
            f"CHAT: {mute_e.chat.title}(`{mute_e.chat_id}`)",
        )
예제 #3
0
async def add_filter(chatid, keyword, msg_id):
    to_check = await get_filter(chatid, keyword)

    if not to_check:
        cli.insert_one({'chat_id': chatid, 'keyword': keyword, 'msg': msg_id})
        return True
    else:
        cli.update_one(
            {
                '_id': to_check["_id"],
                'chat_id': to_check["chat_id"],
                'keyword': to_check["keyword"],
            }, {"$set": {
                'msg': msg_id
            }})

        return False
예제 #4
0
async def add_user(user, mute, gmute, gban, chat):
    return cli.insert_one({
        "User": user,
        "Mute": mute,
        "GMute": gmute,
        "GBan": gban,
        "Chat": chat
    })
예제 #5
0
async def add_note(chatid, name, text):
    to_check = await get_note(chatid, name)

    if not to_check:
        cli.insert_one({'chat_id': chatid, 'name': name, 'text': text})

        return True
    else:
        cli.update_one(
            {
                '_id': to_check["_id"],
                'chat_id': to_check["chat_id"],
                'name': to_check["name"],
            }, {"$set": {
                'text': text
            }})

        return False
예제 #6
0
async def add_welcome_setting(chat_id, should_clean_welcome, previous_welcome,
                              f_mesg_id):
    check = await get_current_welcome_settings(chat_id)
    if not check:
        cli.insert_one({
            'chat_id': chat_id,
            'should_clean_welcome': should_clean_welcome,
            'previous_welcome': previous_welcome,
            'f_mesg_id': f_mesg_id
        })
        return True
    cli.update_one(
        {
            '_id': check['_id'],
            'chat_id': check['chat_id'],
            'should_clean_welcome': should_clean_welcome,
            'previous_welcome': check['previous_welcome']
        }, {'$set': {
            'f_mesg_id': f_mesg_id
        }})
    return False
예제 #7
0
async def set_path(path):
    return cli.insert_one({"Path": path})
예제 #8
0
async def set_message(msg):
    return cli.insert_one({"ID": 2, "Message": msg})
예제 #9
0
async def others(opt):
    return cli.insert_one({"Others": opt})
예제 #10
0
async def set_afk(msg, time):
    return cli.insert_one({"Message": msg, "AFKTime": time})
예제 #11
0
async def set_gfolder(id):
    return cli.insert_one({"GFolder": id})
예제 #12
0
async def set_restart(chat, msg):
    return cli.insert_one({"Restart": True, "Chat": chat, "Message": msg})
예제 #13
0
async def set_limit(digit):
    return cli.insert_one({"Limit": digit})
예제 #14
0
async def approve(user):
    return cli.insert_one({"Approved": user})
예제 #15
0
async def set_antipm(opt):
    return cli.insert_one({"AntiPM": opt})
예제 #16
0
async def add(key, value, media):
    return cli.insert_one(
        {"Key": key, "Value": value, "Media": media})
예제 #17
0
async def add_blacklist(chat_id, trigger):
    return cli.insert_one({"chat_id": chat_id, "trigger": trigger})
예제 #18
0
async def set_pack(pack):
    return cli.insert_one({"Pack": pack})
예제 #19
0
async def set_prefix(prefix):
    return cli.insert_one({"Prefix": prefix})
예제 #20
0
async def set_notif(opt):
    return cli.insert_one({"Notifications": opt})
예제 #21
0
async def set_asset(id):
    return cli.insert_one({"Asset": id})
예제 #22
0
async def set_sblock(opt):
    return cli.insert_one({"SuperBlock": opt})
예제 #23
0
async def save_file(name, path, file):
    return cli.insert_one({"Name": name, "Path": path, "File": file})
예제 #24
0
async def mute(chatid, userid):
    if await is_muted(chatid, userid) is True:
        return False
    cli.insert_one({'chat_id': chatid, 'user_id': userid})
    return True
예제 #25
0
async def set_godark(opt):
    return cli.insert_one({"GoDark": opt})
예제 #26
0
async def dload(name, link):
    return cli.insert_one({"Name": name, "URL": link})
예제 #27
0
async def add(key, value):
    return cli.insert_one(
        {"Key": key, "Value": value})
예제 #28
0
async def set_city(city):
    return cli.insert_one({"City": city})
예제 #29
0
async def add_blacklist(id):
    return cli.insert_one({"Blacklist": id})
예제 #30
0
async def set_name(name):
    return cli.insert_one({"ID": 1, "Name": name})