Exemple #1
0
async def sedlyfsir(event):
    msgtobroadcast = event.pattern_match.group(1)
    userstobc = get_all_users()
    error_count = 0
    sent_count = 0
    for starkcast in userstobc:
        try:
            sent_count += 1
            await chatbot.send_message(
                int(starkcast.chat_id),
                "<b>You Recived A Broadcast Message 📡</b>",
                parse_mode="HTML")
            await chatbot.send_message(int(starkcast.chat_id), msgtobroadcast)
            await asyncio.sleep(0.2)
        except Exception as e:
            try:
                logger.info(
                    f"Error : {error_count}\nError : {e} \nUsers : {chat_id}")
            except:
                pass
    await chatbot.send_message(
        event.chat_id,
        f"<b>Broadcast Done in <u>{sent_count}</u> Group/Users and I got <u>{error_count}</u> Error and Total Number Was <u>{len(userstobc)}</u></b>",
        parse_mode="HTML")
    await chatbot.send_message(
        Config.DUMB_CHAT,
        f"You BroadCasted A New Message. \nMessage - {msgtobroadcast} \nSent Count - {sent_count}"
    )
Exemple #2
0
async def sedlyfsir(event):
    msgtobroadcas = event.text
    msgtobroadcast = msgtobroadcas[9:]
    userstobc = get_all_users()
    error_count = 0
    sent_count = 0
    for starkcast in userstobc:
        try:
            await chatbot.send_message(int(starkcast.chat_id), msgtobroadcast)
        except Exception as e:
            error_count += 1
    sent_count = error_count - len(userstobc)
    await chatbot.send_message(
        event.chat_id,
        f"<b>Broadcast Done in <u>{sent_count}</u> Group/Users and I got <u>{error_count}</u> Error and Total Number Was <u>{len(userstobc)}</u></b>",
        parse_mode="HTML")
    await chatbot.send_message(
        Config.DUMB_CHAT,
        f"You BroadCasted A New Message. \nMessage - {msgtobroadcast} \nSent Count - {sent_count}"
    )
Exemple #3
0
async def starkisnoob(event):
    starkisnoob = get_all_users()
    await event.reply(f"<b>I have <u>{len(starkisnoob)}</u> Users In Database.</b>", parse_mode="HTML")