def main():
    host = sys.argv[1]

    client = GMatrixClient(host, user_id=USER_ID, token=ACCESS_TOKEN)
    client.join_room(ROOM_ALIAS)

    current_presence = "offline"
    while True:
        if current_presence == "offline":
            client.set_presence_state(UserPresence.ONLINE.value)
        else:
            client.set_presence_state(UserPresence.OFFLINE.value)

        # Confirm user presence
        current_presence = client.get_user_presence(USER_ID)

        print("Change status to: ", current_presence)

        gevent.sleep(5)
def main(keystore_file: str, password: str, host: str, room_id: str, other_user_id: str):
    private_key = get_private_key(keystore_file, password)
    client = GMatrixClient(host)

    user = login(client=client, signer=LocalSigner(private_key=decode_hex(private_key)))

    log.info("Logged in", user=user, server=host, room_id=room_id)
    # print("TKN: \n" + client.token)

    client.add_presence_listener(callback)
    client.start_listener_thread()

    # try:
    client.join_room(room_id)
    # except MatrixRequestError:
    #     client.create_room(alias="raiden_goerli_discovery", is_public=True)

    while True:
        current_presence = client.get_user_presence(other_user_id)
        log.warning("User presence", other_user=other_user_id, presence=current_presence)

        gevent.sleep(1)