yapin.py
Python library for building bots on Yapin'.
yapin.py is built on yapper.py: it installs it for you, and import yapin gives you everything import yapper does (same classes, same behaviour, updates come with new yapper.py releases).
Install
pip install yapin.py
Python 3.10 or newer.
Quick start
Make a bot token in Settings -> Developer (it starts with yb_) and put it in a .env file next to your bot:
YAPIN_BOT_TOKEN=yb_your_token_here
Then write bot.py:
import yapin
bot = yapin.Bot() # reads YAPIN_BOT_TOKEN (or YAPPER_BOT_TOKEN) from the environment or your .env file
@bot.command("ping", "Check if the bot is alive")
def ping(msg):
msg.reply("pong")
@bot.command("vote", "Start a pizza vote")
def vote(msg):
msg.reply(
embeds=yapin.Embed().title("Pizza tonight?").color("blue"),
components=yapin.Row(
yapin.Button.success("Yes", "vote:yes"),
yapin.Button.danger("No", "vote:no"),
),
)
@bot.button("vote:") # clicks on buttons whose custom_id starts with "vote:"
def voted(i):
i.ephemeral("You picked " + i.custom_id[5:])
@bot.on("member_join")
def welcome(ev):
print(f"{ev.username} joined")
bot.run()
Run it with python bot.py. People can now type /ping or !ping. Nothing to host: the bot connects out to Yapin' and gets its events pushed.
Tokens and the .env file
The token is read from YAPIN_BOT_TOKEN or YAPPER_BOT_TOKEN in your environment, then from a .env file in the folder you run from (or a parent folder). A variable that is already set in the environment always wins over the file. You can also pass it directly: yapin.Bot("yb_...").
What you get
- Commands, events and buttons:
@bot.command(...),@bot.on("member_join"),@bot.button("prefix:"). - Embeds, buttons and Components V2 layouts:
yapin.Embed,yapin.Button,yapin.Row,yapin.Container,yapin.Sectionand friends, sent withmsg.reply(...)orbot.send_layout(...). - Cogs: group features into
yapin.Cogclasses, one file per topic, and load a folder withbot.load_cogs("cogs"). - The whole API: messages, members, roles, channels, moderation, voice, webhooks and more as
bot.*methods. Every one has a docstring:help(yapin.Bot.send). - Errors: failed calls raise
yapin.YapperError(also available asyapin.YapinError) with.statusand.retry_after.
For the full tour with examples (cogs, Components V2, every bot.* method) see the yapper.py README; everything there works with yapin in place of yapper. Payload details and limits are in the Yapin' docs: https://yapin.gg/developers
License
GPL-3.0-only
Metadata
Release files for yapin.py 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| yapin_py-2.0.0.tar.gz | 17.0 kB | With provenance | Details for yapin_py-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| yapin_py-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for yapin_py-2.0.0-py3-none-any.whl |
Total release size: 32.7 kB
Release files / yapin_py-2.0.0.tar.gz
| Download URL | yapin_py-2.0.0.tar.gz |
|---|---|
| Size | 17.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2bcdb0200000535de639ff3fc157874076419631575096803697e5c56c2eeb13
|
|
BLAKE2b-256 checksum How to use checksums |
3a75517d1e8e96f2913346656ec0f79366ea3886e97dde4df2dee2d7b73a82b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.
Transparency logRelease files / yapin_py-2.0.0-py3-none-any.whl
| Download URL | yapin_py-2.0.0-py3-none-any.whl |
|---|---|
| Size | 15.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
723f8d9e4a95dd9a699f42351e321c6777944b19df07648af8494e9717c9e02a
|
|
BLAKE2b-256 checksum How to use checksums |
2994c0b64fb3f24bbcf6805c670a961a5d7f8c93f096941cfd9f575be1cbba01
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.
Transparency logSecurity for yapin.py 2.0.0
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for yapin_py-2.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.
Transparency logA 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.