Library designed to ease the creation of bots for Picarto.
Project description
PicaBot
PicaBot is a Python library designed to simplify the creation of bots for Picarto.tv. It provides a framework for handling WebSocket connections, managing commands, and handling events, making it easy to build and customize your own bot.
Features
- Easy WebSocket Connection: Seamlessly connect to Picarto.tv using WebSockets.
- Command Management: Define custom commands with a prefix, and let your bot respond to user inputs.
- Event Handling: Register handlers for different events like
message
(more in the future). - Reconnection Handling: Automatically attempts to reconnect in case of connection loss.
Installation
You can install PicaBot via pip:
pip install picabot
Usage
Here is a basic example of how to use PicaBot to create a bot:
import asyncio
from picabot import PicaBot, PicaMessage
bot = PicaBot.from_password(
"BOT_ACCOUNT_USERNAME",
"BOT_ACCOUNT_PASSWORD from https://oauth.picarto.tv/chat/bot",
"BOT_CHANNEL_NAME"
)
@bot.command("hello")
async def hello_command(message: PicaMessage, *args):
await bot.send_message(f"Hello, {message.user_name}!")
@bot.on("message")
async def on_message(message: PicaMessage):
print(f"{message.user_name}: {message.message}")
asyncio.run(bot.connect())
Contributing
Contributions are welcome! Feel free to submit issues or pull requests.
License
PicaBot is licensed under the GNU GPL-3.0 License. See LICENSE
for more details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file picabot-0.1.2.tar.gz
.
File metadata
- Download URL: picabot-0.1.2.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cdfd421d504adb5ee52b8f8938343b32be3ea5a3d6d07ca46782ec9dbf66d2d0 |
|
MD5 | bdc9030dedb01cfa24830a6b2c74fbcd |
|
BLAKE2b-256 | ebb82982274914850074fe373709cf05ada60e38c807c3cf7fc4948aa3545d2d |
File details
Details for the file picabot-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: picabot-0.1.2-py3-none-any.whl
- Upload date:
- Size: 16.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ad53c72622eaafaaa7e667ea8fb79eabbcedd20c7ce7ffa7ce63b783ae97246 |
|
MD5 | 2b88462af5ba82d38d0da5dc44ab8be6 |
|
BLAKE2b-256 | c459fdb50487abee1e4424f39f3d0cd86bb769b017b66ee493eaba3047c4271f |