🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

twitchypy_irc

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

twitchypy_irc

Allows you to connect to Twitch IRC and send and receive messages.

0.1.3
PyPI
Maintainers
1

Python Twitch IRC Library

This is a simple Python library for connecting to the Twitch IRC chat and sending/receiving messages.

Twitch

This is the main class for the Twitch IRC client and has the following methods:

  • __init__(self, user: str = "justinfan12345", token: str = "oauth:1234567890"): Initializes the client with the given username and OAuth token.
  • join(self, channel: str) -> None: Joins the given channel.
  • leave(self, channel: str) -> None: Leaves the given channel.
  • connect(self) -> None: Connects to the Twitch IRC server.
  • disconnect(self) -> None: Disconnect from the Twitch IRC server.
  • send_message(self, channel: str, message: str) -> None: Sends a message to the given channel.
  • send_reply(self, message_id: str, channel: str, reply: str) -> None: Sends a reply to the given message.
  • read(self) -> Generator[TwitchPrivateMessage, None, None]: Reads messages from the Twitch IRC server.

TwitchPrivateMessage

This class represents a Twitch private message and has the following attributes:

  • badges (set): A set of strings representing the badges the user has.
  • color (str): The color of the user's username in the chat.
  • name (str): The user's display name.
  • first_message (bool): Whether this is the user's first message in the chat.
  • message_id (str): The ID of the message.
  • is_moderator (bool): Whether the user is a moderator.
  • is_broadcaster (bool): Whether the user is the broadcaster.
  • is_returning_chatter (bool): Whether the user has been in the chat before.
  • room_id (int): The ID of the room.
  • is_subscriber (bool): Whether the user is a subscriber.
  • is_turbo (bool): Whether the user has Twitch Turbo.
  • user_id (int): The ID of the user.
  • name (str): The user's name.
  • channel (str): The channel the message was sent to.
  • content (str): The contents of the message.

Usage

To use this library, create a Twitch instance and call its methods to connect to the Twitch IRC chat and send/receive messages.

from twitch import Twitch

client = Twitch(user="your_username", token="your_oauth_token")
client.connect()
client.join("your_channel")
client.send_message("your_channel", "Hello, world!")
for message in client.read():
    print(message.name + ": ", message.content)
client.disconnect()

Contributing

All contributions are welcome! Please open an issue or pull request if you have any suggestions or find any bugs.

License

This project is licensed under the MIT License - see the LICENSE file for details.

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts