Skip to main content

YapPy

A Python API binding for Yapper.

YapPy brings a Python-friendly interface to Yapper, a chat platform similar to Discord. It provides familiar models, event handlers, and command decorators so you can build Yapper bots with straightforward asynchronous Python.

Project status: Early development. The current implementation includes Context, Message, Channel, and User models, along with bot event and command handling. The API may change as development continues.

Features

  • Python-first API — build bot logic using async functions and decorators.
  • Event handlers — respond to Yapper events such as incoming messages.
  • Commands — register named commands with descriptions.
  • Context-based interactions — reply to messages through a context object.
  • Core models — work with Context, Message, Channel, and User objects.
  • Optional logging — enable verbose output when creating the application.

Installation

pip install python-yappy

Quick start

This example uses the dotenv module from pip install load_dotenv Create a file named main.py:

from yappy import App
import os
from dotenv import load_dotenv
load_dotenv()
bot = App(verbose=True)
@bot.event(
	"message"
)
async def on_message(ctx):
	if ctx.is_bot:
		return
	await bot.process_command(ctx)
@bot.command(
	name="ping",
    description="replies with 'Pong!'"
)
async def ping(ctx):
	await ctx.reply("Pong!")	

@bot.command(
	name="react",
	description="React your message with a certain emoji!"
)
async def react(ctx, emoji: str):
	await ctx.message.react(emoji)
@bot.event(
	"ready"
)
async def on_ready():
	print("Logged as", bot.user.name)

bot.run(os.getenv("TOKEN"))

Create a .env file beside bot.py:

TOKEN=your_yapper_bot_token

Then run the bot:

python bot.py

This example registers a message event that replies with Hi! to messages not sent by bots, and a ping command that replies with Pong!.

Keep your token private. Do not commit your .env file or publish your bot token.

Core concepts

App

App is the main entry point for creating and running a YapPy bot.

from yappy import App

bot = App(verbose=True)
bot.run("YOUR_TOKEN")

Set verbose=True to enable verbose output while developing. Keep credentials in environment variables rather than hard-coding them in source files.

Events

Register an event handler with @bot.event(...). Event handlers are asynchronous functions.

@bot.event("message")
async def on_message(ctx):
    if ctx.is_bot:
        return

    await ctx.process.command(ctx)

The event name and handler arguments should match the event interface supported by the installed YapPy version.

Commands

Register a command using @bot.command(...):

@bot.command(
    name="ping",
    description="replies with 'Pong!'",
)
async def ping(ctx):
    await ctx.reply("Pong!")

The name identifies the command, and description describes its purpose. Command registration and invocation behavior depend on the current implementation.

Context and models

YapPy currently provides these core models:

Model Purpose
Context Context for handling an interaction or message event.
Message Represents a message.
Channel Represents a channel.
User Represents a user.
Guild Represents a guild / server
Role Represents a role

The example uses the context object (ctx) to check ctx.is_bot and send a reply with ctx.reply(...). Consult the source code for the currently available attributes and methods of each model.

Project status

YapPy is under active development. Current implemented areas include:

  • Context, Message, Channel, and User models
  • Bot event registration and handling
  • Command registration
  • Message replies through the context API

Other features may be planned, incomplete, or unsupported. Check the source code and release notes for the actual capabilities of the version you are using.

Contributing

Contributions, bug reports, and suggestions are welcome. Before opening a pull request, describe the change clearly and include a minimal reproduction or test where appropriate.

License

This project is licensed under the MIT License.

Metadata

Release files for python-yappy 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-yappy 0.1.1
File Size Uploaded Provenance
python_yappy-0.1.1.tar.gz 8.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for python-yappy 0.1.1
File Interpreter ABI Platform
python_yappy-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 18.6 kB

Release files / python_yappy-0.1.1.tar.gz

Download URL python_yappy-0.1.1.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f7ef884431cb2105c3af6673810eadc607163255370bb5584bd3d903655735a0
BLAKE2b-256 checksum
How to use checksums
69272ca3e7033fec2131aa20fdfdddcd8784b0a630dddbf99bd5cd4fe66819c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / python_yappy-0.1.1-py3-none-any.whl

Download URL python_yappy-0.1.1-py3-none-any.whl
Size 10.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f68dabb7ce0b7133053fe3b9b0e7437ed43afd5bdc1dcc0709a102b160d38a1
BLAKE2b-256 checksum
How to use checksums
10ef0c3487cdf7b664542eda3e6d3f93f7d44c42d4c42b3ae448a7271aa36cf0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Security for python-yappy 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page