Example #1
0
async def _(event):
    if event.fwd_from:
        return
    input_chnnl = event.pattern_match.group(1)
    all_chnnl = get_all_chnnl()
    if input_chnnl == "all":
        for channelz in all_chnnl:
            rm_channel(channelz.chat_id)
        await edit_or_reply(event, "Fine. Cleared All Channel Database")
        return
    if input_chnnl == "":
        if event.is_channel and event.is_group:
            input_chnnl = event.chat_id
        else:
            await edit_or_reply(event, "Please Give Group / Channel ID")
            return
    if already_added(input_chnnl):
        rm_channel(input_chnnl)
        await edit_or_reply(
            event, f"Fine. I have Removed {input_chnnl} From DataBase.")
        await borg.send_message(loggy_grp, f"Removed {input_chnnl} From DB")
    elif not already_added(input_chnnl):
        await edit_or_reply(
            event,
            "Are You Sure? , You Haven't Added This Group / Channel To Database"
        )
Example #2
0
async def remove_ch(event):
    if event.fwd_from:
        return
    chat_id = event.pattern_match.group(1)
    if chat_id == "all":
        await edit_or_reply(event, "Removing...")
        channels = get_all_channels()
        for channel in channels:
            rm_channel(channel.chat_id)
        await edit_or_reply(event, "Database cleared.")
        return

    if in_channels(chat_id):
        rm_channel(chat_id)
        await edit_or_reply(event, "Removed from database")
        await asyncio.sleep(3)
        await event.delete()
    elif in_channels(event.chat_id):
        rm_channel(event.chat_id)
        await edit_or_reply(event, "Removed from database")
        await asyncio.sleep(3)
        await event.delete()
    elif not in_channels(event.chat_id):
        await edit_or_reply(event,
                            "Channel is already removed from database. ")
        await asyncio.sleep(3)
        await event.delete()