Skip to content

A bot library for connecting and interacting with Picarto.tv chat websocket

License

Notifications You must be signed in to change notification settings

NobreHD/PicaBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A bot library for connecting and interacting with Picarto.tv chat websocket

Topics

Resources

License

Stars

Watchers

Forks

Languages