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.sent_message(f"Hello, {message.user_name}!")
@bot.on("message")
async def on_message(message: PicaMessage):
print(f"{message.user_name}: {message.message}")
asyncio.run_until_complete(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.1.tar.gz
.
File metadata
- Download URL: picabot-0.1.1.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 | 4a8284080fd42fdc6e087ba326dff7743f126d216dfda8c80b8daf41bf9ecf29 |
|
MD5 | 00fbe19c0c55618950787958edf71932 |
|
BLAKE2b-256 | bdbc698c0e32e16a30c4b5ef6274553a3155405b2ff8b88c7445ccd39f4c49b3 |
File details
Details for the file picabot-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: picabot-0.1.1-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 | 5c9951356130de42d7bf0c3f58460afc0b429b875b1fb8595bac2349d4d97664 |
|
MD5 | 55bf6af8d71eae78dbda4de682890fa0 |
|
BLAKE2b-256 | 29ceaa8ec6b0636fba29201192018ddb15cefaa23bd916f6bc640633ad51f267 |