async def add_chat_service(chatid):
    check = await get_service(chatid)

    if not check:
        cli.insert_one({'chatid': chatid})
        return True
    cli.update_one({
        '_id': check['id'],
    }, {'&set': {
        'chatid': check['chatid']
    }})
    return False
Beispiel #2
0
async def set_weather(city):
    to_check = await get_weather()

    if to_check:
        cli.update_one(
            {
                '_id': to_check['_id'],
                'weather_city': to_check['weather_city']
            }, {"$set": {
                'weather_city': city
            }})
    else:
        cli.insert_one({'weather_city': city})
Beispiel #3
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
    cli.update_one(
        {
            '_id': to_check["_id"],
            'chat_id': to_check["chat_id"],
            'trigger': to_check["trigger"],
        }, {"$set": {
            'trigger': trigger
        }})
    return False
Beispiel #4
0
async def mute_chat(mute_e):
    from userbot.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}`)",
        )
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
    cli.update_one(
        {
            '_id': to_check["_id"],
            'chat_id': to_check["chat_id"],
            'keyword': to_check["keyword"],
        }, {"$set": {
            'msg': msg_id
        }})

    return False
Beispiel #6
0
async def set_ses(chat_id, ses_id, expires):
    check = await is_chat(chat_id)
    if not check:
        cli.insert_one({
            'chat_id': chat_id,
            'ses_id': ses_id,
            'expires': expires
        })
        return True
    cli.update_one({
        '_id': check['_id'],
    }, {'$set': {
        'ses_id': check['ses_id'],
        'expires': check['expires']
    }})
    return False
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
    cli.update_one(
        {
            '_id': to_check["_id"],
            'chat_id': to_check["chat_id"],
            'name': to_check["name"],
        }, {"$set": {
            'text': text
        }})

    return False
Beispiel #8
0
async def add_user(user, mute, gmute, gban, chat):
    return cli.insert_one({
        "User": user,
        "Mute": mute,
        "GMute": gmute,
        "GBan": gban,
        "Chat": chat
    })
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
Beispiel #10
0
async def set_godark(opt):
    return cli.insert_one({"GoDark": opt})
async def set_pack(pack):
    return cli.insert_one({"Pack": pack})
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
async def dload(name, link):
    return cli.insert_one({"Name": name, "URL": link})
Beispiel #14
0
async def add_blacklist(chat_id, trigger):
    return cli.insert_one({"chat_id": chat_id, "trigger": trigger})
async def set_city(city):
    return cli.insert_one({"City": city})
async def gmute(userid):
    if await is_gmuted(userid) is True:
        return False
    cli.insert_one({'user_id': userid})
    return True
async def set_restart(chat, msg):
    return cli.insert_one({"Restart": True, "Chat": chat, "Message": msg})
Beispiel #18
0
async def set_afk(msg, time):
    return cli.insert_one({"Message": msg, "AFKTime": time})
async def add(key, value):
    return cli.insert_one(
        {"Key": key, "Value": value})
async def set_asset(id):
    return cli.insert_one({"Asset": id})
async def set_path(path):
    return cli.insert_one({"Path": path})
Beispiel #22
0
async def save_file(name, path, file):
    return cli.insert_one({"Name": name, "Path": path, "File": file})
async def set_prefix(prefix):
    return cli.insert_one({"Prefix": prefix})
async def others(opt):
    return cli.insert_one({"Others": opt})
async def set_gfolder(id):
    return cli.insert_one({"GFolder": id})
async def add_chat_fban(chatid):
    if await is_fban(chatid) is True:
        return False
    cli.insert_one({'chatid': chatid})
Beispiel #27
0
async def add_chat_gban(chatid):
    if await is_gban(chatid) is True:
        print("FAILED")
        return False
    else:
        cli.insert_one({'chatid': chatid})