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()
async def _(event): 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 event.edit("Fine. Cleared All Channel Database") return if input_chnnl is "": if event.is_channel and event.is_group: input_chnnl = event.chat_id else: await event.edit("Please Give Group / Channel ID") return if already_added(input_chnnl): rm_channel(input_chnnl) await event.edit(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 event.edit( "Are You Sure? , You Haven't Added This Group / Channel To Database" )