Skip to main content

An asynchronous library for creating scripts and chatbots in Clover.Space;

Project description

Clover.Space (Project Z)

A simple python asynchronous library for interaction with Clover.Space (old Project Z)

This library is a fork of ProjZ.py. Updated by myself with the help of MrWest.

Installation

pip install cloverspace

❗ The following examples need to be updated!

Example - login and get object id from link

import projz
from asyncio import get_event_loop

client = projz.Client()


async def main():
    result = await client.login_email("your email", "your password")
    print(f"Logged in to account with nickname {result.user_profile.nickname}")
    info = await client.get_link_info("link here")
    print(f"Object id: {info.object_id}, object type: {info.object_type}")

if __name__ == "__main__":
    get_event_loop().run_until_complete(main())

Example - login and post blog

import projz
from asyncio import get_event_loop
from aiofiles import open as async_open

client = projz.Client()


async def main():
    result = await client.login_email("your email", "your password")
    print(f"Logged in to account with nickname {result.user_profile.nickname}")
    circle_link_info = await client.get_link_info(input("Circle link: "))
    await client.post_blog(
        "Blog title",
        "Blog content",
        content_rich_format=projz.RichFormatBuilder().h1(0, 4).build(),
        cover=await client.upload_file(await async_open("cover-file.png", "rb"), projz.EUploadTarget.FOREGROUND),
        background=await client.upload_file(await async_open("bg-file.png", "rb"), projz.EUploadTarget.BACKGROUND),
        circle_list=[circle_link_info.object_id]
    )


if __name__ == "__main__":
    get_event_loop().run_until_complete(main())

Example - receive messages

import projz
from asyncio import get_event_loop

client = projz.Client()


@client.on_message()
async def handle_echo(message: projz.ChatMessage):
    if message.content is not None:
        await client.send_message(message.thread_id, content=message.content)


# You can specify the command prefix in the arguments of the decorator or Client. 
# The slash / is set by default.


@client.on_command("off")  # = on_message("/off")
async def handle_off(message: projz.ChatMessage):
    await client.change_chat_online_status(message.thread_id, is_online=False)


async def main():
    await client.login_email("your email", "your password")
    print("Waiting for the messages...")


if __name__ == "__main__":
    loop = get_event_loop()
    loop.run_until_complete(main())
    loop.run_forever()

Addition: Using CLI functions

Print available functions

python -m projz list-actions

Login to an account with email and print info about it

python -m projz login --auth email --login yourlogin --password yourpassword

Or with phone number

python -m projz login --auth phone --login yourlogin --password yourpassword

Get information about the link

python -m projz link-info --auth email --login yourlogin --password yourpassword --info yourlink

Send messages to the chat

python -m projz send-message --auth email --login yourlogin --password yourpassword --thread chatlink --repeat 150

Join to the circle

python -m projz join-circle --auth email --login yourlogin --password yourpassword --circle circlelink

Leave from the circle

python -m projz leave-circle --auth email --login yourlogin --password yourpassword --circle circlelink

Listen for the chat messages

python -m projz listen --auth email --login yourlogin --password yourpassword

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cloverspace-3.0.1.tar.gz (31.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cloverspace-3.0.1-py3-none-any.whl (48.1 kB view details)

Uploaded Python 3

File details

Details for the file cloverspace-3.0.1.tar.gz.

File metadata

  • Download URL: cloverspace-3.0.1.tar.gz
  • Upload date:
  • Size: 31.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for cloverspace-3.0.1.tar.gz
Algorithm Hash digest
SHA256 62810e9763b658eb5e74f3a42cb3dcbf51e3677e259154a464e4c63f81c6fd5e
MD5 40426d2594f38ce8e2a7910e5bee50da
BLAKE2b-256 f3412404b39e1fc269175e1766d2b402142b6f41b9900fd5366efc2b87e67b99

See more details on using hashes here.

File details

Details for the file cloverspace-3.0.1-py3-none-any.whl.

File metadata

  • Download URL: cloverspace-3.0.1-py3-none-any.whl
  • Upload date:
  • Size: 48.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for cloverspace-3.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6140910da76b5f9d90828784fea1c5c48356bb3c3b18ca1cde73c6c5ee64b22b
MD5 b98c1568d5e4a399fc7e528213871944
BLAKE2b-256 77820f2512722e5f2f1ef9be84fb3a864eb0eaf7d6984e01068d33783d431036

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page