Exemple #1
0
async def tgr_send(event: NewMessage.Event) -> None:
    if not event.reply_to_msg_id:
        await event.answer("`I need a retard to proceed!`")
        return

    reply = await event.get_reply_message()

    # Forward the message to TGR
    await client.forward_messages(entity=tgr_entity,
                                  messages=reply,
                                  silent=True,
                                  from_peer=reply.chat_id)

    divider = client(
        GetStickersRequest(emoticon='❤', hash=-1447283942124334054))

    # Send the divider sticker
    await client(
        SendMediaRequest(
            entities=tgr_entity,
            message='',
            peer=client.get_entity("hyperterminal"),
            media=InputMediaDocument(
                id=InputDocument(id=divider.id,
                                 access_hash=divider.access_hash,
                                 file_reference=divider.file_reference))))

    await event.answer(f"`{random.choice(SUCCESS_MESSAGES)}`")
Exemple #2
0
print(userbot.__copyright__)
print("Licensed under the terms of the " + userbot.__license__)


def wakeup():
    client.loop.call_later(0.1, wakeup)


if __name__ == "__main__":
    client.register_commands = True
    client.pluginManager = pluginManager.PluginManager(client)
    client.pluginManager.import_all()
    client.pluginManager.add_handlers()
    client.loop.run_until_complete(client.connect())
    config = client.loop.run_until_complete(
        client(functions.help.GetConfigRequest()))
    for option in config.dc_options:
        if option.ip_address == client.session.server_address:
            if client.session.dc_id != option.id:
                LOGGER.warning(
                    f"Fixed DC ID in session from {client.session.dc_id}"
                    f" to {option.id}")
            client.session.set_dc(option.id, option.ip_address, option.port)
            client.session.save()
            break
    try:
        client.start()
    except (AuthKeyError, InvalidBufferError):
        client.session.delete()
        LOGGER.error(
            "Your old session was invalid and has been automatically deleted! "