Skip to main content

Official Python library for the Clovord platform.

Project description

clovord

A Python SDK for interacting with the Clovord Gateway and REST API.

Installation

pip install clovord

For local development:

pip install -e .[dev]

Usage

import clovord
import os
from clovord import Bot
import json


intents = clovord.Intents.default()
intents.members = True
intents.messages = True
intents.presence = True

bot = Bot(intents=intents)

@bot.event
async def on_ready():
    print("READY EVENT FIRED")

bot.run(os.environ["BOT_TOKEN"])

Overview

  • Bot is the main entrypoint.
  • The Gateway connection is handled internally with heartbeat and reconnect support.
  • The REST client is asynchronous and available through bot.http.

Extensions (Cogs-like)

clovord.py supports extension modules via setup(bot).

# handlers/message_create.py
def setup(bot):
    @bot.event
    async def on_message_create(message):
        if bot.user and message.author.id == bot.user.id:
            return

        if message.content.startswith("!"):
            await message.channel.send(
                "Hello from extension",
                embeds=[{"title": "Welcome", "description": "Embed support"}],
                container={"type": "card", "accent": "brand"},
            )
from pathlib import Path
from clovord import Bot

bot = Bot()

# Load one importable module
bot.load_extension("mybot.handlers.message_create")

# Load multiple modules
bot.load_extensions(
    "mybot.handlers.message_create",
    "mybot.handlers.ready",
)

# Load all modules from a package (and subpackages)
bot.load_extensions_from_package("mybot.handlers")

# Load all modules from a folder path (and subfolders)
bot.load_extensions_from_path(Path(__file__).parent / "handlers")

Latest Release Notes

Version: 0.1.12dev5 Last commit: fix: remove unused on_ready_payload event handler from README

Added

  • add support for extension modules and enhance error handling

Fixed

  • remove unused on_ready_payload event handler from README
  • revert version to 0.1.12 from 0.1.12dev4

Docs

  • update for v0.1.12dev4

Other

See full history in CHANGELOG.md.

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

clovord_py-0.1.13.dev3.tar.gz (19.6 kB view details)

Uploaded Source

Built Distribution

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

clovord_py-0.1.13.dev3-py3-none-any.whl (21.4 kB view details)

Uploaded Python 3

File details

Details for the file clovord_py-0.1.13.dev3.tar.gz.

File metadata

  • Download URL: clovord_py-0.1.13.dev3.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for clovord_py-0.1.13.dev3.tar.gz
Algorithm Hash digest
SHA256 995483a1f74669433ccff9384ed5564e1ab7d5a7c61239aa6e796fdb37cbbc40
MD5 e2f6c993637e26b9de635d307786eefc
BLAKE2b-256 c5e68cf24cd68f33e63d0830092bf06915813c75fb52ce4a405ee7ef22fc92c2

See more details on using hashes here.

Provenance

The following attestation bundles were made for clovord_py-0.1.13.dev3.tar.gz:

Publisher: release.yml on Clovord/Library---py---clovord.py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file clovord_py-0.1.13.dev3-py3-none-any.whl.

File metadata

File hashes

Hashes for clovord_py-0.1.13.dev3-py3-none-any.whl
Algorithm Hash digest
SHA256 8f8f5ba485fcab2e4b6e472c5582f14fb048aff5969d0dfb9a3e51bbd5b24e1f
MD5 da221afb2b9aa83f295513a477943199
BLAKE2b-256 87e68d2c269cbb8d6752585818ad7dd25a3c970222b08d70bfdb161c2bc5cf3c

See more details on using hashes here.

Provenance

The following attestation bundles were made for clovord_py-0.1.13.dev3-py3-none-any.whl:

Publisher: release.yml on Clovord/Library---py---clovord.py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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