async def sedlyfsir(event): msgtobroadcast = event.pattern_match.group(1) userstobc = get_all_users() error_count = 0 sent_count = 0 hmmok = "" if msgtobroadcast == None: await event.reply("`Wait. What? Broadcast None?`") return elif msgtobroadcast == " ": await event.reply("`Wait. What? Broadcast None?`") return for freakcast in userstobc: try: sent_count += 1 await freakybot.send_message( int(freakcast.chat_id), "**Hey, You Have Received A New Broadcast Message**", ) await freakybot.send_message(int(freakcast.chat_id), msgtobroadcast) await asyncio.sleep(0.2) except Exception as e: hmmok += f"Errors : {e} \n" error_count += 1 await freakybot.send_message( event.chat_id, f"Broadcast Done in {sent_count} Group/Users and I got {error_count} Error and Total Number Was {len(userstobc)}", )
async def users(event): if event.query.user_id == bot.uid: await event.delete() total_users = get_all_users() users_list = "List Of Total Users In Bot. \n\n" for freaked in total_users: users_list += ("==> {} \n").format(int(freaked.chat_id)) with io.BytesIO(str.encode(users_list)) as tedt_file: tedt_file.name = "userlist.txt" await freakybot.send_file( event.chat_id, tedt_file, force_document=True, caption="Total Users In Your Bot.", allow_cache=False, ) else: pass
async def freakispro(event): dayamispro = get_all_users() await event.reply( f"**Stats Of Your Bot** \nTotal Users In Bot => {len(dayamispro)}")