Exemplo n.º 1
0
async def list_all(event):
    ultroid_bot = event.client
    x = await event.eor(get_string("com_1"))
    channels = get_destinations()
    num = get_no_destinations()
    if not num:
        return await eor(x, "No chats were added.", time=5)
    msg = get_string("cha_7")
    for channel in channels:
        name = ""
        try:
            name = get_display_name(await ultroid_bot.get_entity(int(channel)))
        except BaseException:
            name = ""
        msg += f"\n=> **{name}** [`{channel}`]"
    msg += f"\nTotal {get_no_destinations()} channels."
    if len(msg) > 4096:
        MSG = msg.replace("*", "").replace("`", "")
        with io.BytesIO(str.encode(MSG)) as out_file:
            out_file.name = "channels.txt"
            await ultroid_bot.send_file(
                event.chat_id,
                out_file,
                force_document=True,
                allow_cache=False,
                caption="Destination channels in database",
                reply_to=event,
            )
            await x.delete()
    else:
        await x.edit(msg)
Exemplo n.º 2
0
async def _(e):
    if udB.get("AUTOPOST") != "True":
        return
    x = get_source_channels()
    th = await e.get_chat()
    if str(th.id) not in x:
        return
    y = get_destinations()
    for ys in y:
        try:
            await ultroid_bot.send_message(int(ys), e.message)
        except Exception as ex:
            await asst.send_message(int(udB["LOG_CHANNEL"]), str(ex))
Exemplo n.º 3
0
async def autopost_func(e):
    if not udB.get_key("AUTOPOST"):
        return
    x = get_source_channels()
    th = await e.get_chat()
    if get_peer_id(th) not in x:
        return
    y = get_destinations()
    for ys in y:
        try:
            await e.client.send_message(int(ys), e.message)
        except Exception as ex:
            try:
                ERROR[str(ex)]
            except KeyError:
                ERROR.update({str(ex): ex})
                Error = f"**Error on AUTOPOST**\n\n`{ex}`"
                await asst.send_message(udB.get_key("LOG_CHANNEL"), Error)