示例#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})