Skip to main content

Async IRC Client

Project description

AsyncIRCClient

Async (Twitch-) IRC client

First async code so takee everything with a bit of caution

Installation

pip install AsyncIRCClient

Example usage

from loguru import logger

from async_irc_client.async_irc_client import TwitchIRCBot, Message


class MyBot(TwitchIRCBot):

    # subscribe to twitch's irc events
    async def on_client_ready(self, message: Message) -> None:
        logger.info("Bot is Ready")

    # create commands
    @TwitchIRCBot.command("test")
    async def test_command(self, message: Message) -> None:
        self.send_chat_message(f"Hello World {message.source.nick}")

    # mod only command
    @TwitchIRCBot.command("mod_test", mod_only=True)
    async def mod_test_command(self, message: Message) -> None:
        self.send_chat_message(f"Hello World mod {message.source.nick}")

    @TwitchIRCBot.command("alias_test", aliases=["alias_1", "alias_2"])
    async def alias_test_command(self, message: Message) -> None:
        self.send_chat_message("Call as alias!")

    # when using case-insensitive commands you may not use
    # any other command with the same name as any case-insensitive combination
    # works with aliases
    @TwitchIRCBot.command("case_insensitive", case_sensitive=False)
    async def case_insensitive_command(self, message: Message) -> None:
        self.send_chat_message("Case insensitive")

    # repeat a task
    # runs once the client is ready and after the specified time interval
    # here 1000s
    @TwitchIRCBot.loop(1000)
    async def my_task(self):
        logger.info("Hello World")

    # repeat a task at given time
    # is 1 second delayed to prevent double trigger inaccuracies
    @TwitchIRCBot.loop(time="08:36")
    async def my_timed_task(self):
        logger.info("Hello World at 08:36")


if __name__ == "__main__":
    from async_irc_client import Proxy, ProxyType

    MyBot(
        oauth_token="YOURTOKEN",
        nick_name="BOTNAME",
        channel="CHANNELNAME",
        proxies=[
            Proxy(ProxyType.HTTP, "ip", 1234),
            Proxy(ProxyType.HTTP, "ip", 1234, password="password", username="username"),
            Proxy.from_url("proxy_url")
        ]
    ).run()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

AsyncIRCClient-0.1.0.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

AsyncIRCClient-0.1.0-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file AsyncIRCClient-0.1.0.tar.gz.

File metadata

  • Download URL: AsyncIRCClient-0.1.0.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.5

File hashes

Hashes for AsyncIRCClient-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a34c388b3e2b61871f9c7d10aaddea7263cfc0b37b96f266d6a0b87bfa80bb8e
MD5 5c7216b64c24aa20cbd5be267c91a282
BLAKE2b-256 db63f111f6636c734b67d47177db6cf7b1aea2103fe19b028a973e4578f95ad1

See more details on using hashes here.

File details

Details for the file AsyncIRCClient-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: AsyncIRCClient-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.5

File hashes

Hashes for AsyncIRCClient-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3ba768a6ac16f924a8962d8fb6fa28d7918036a318970558a7fcbc58e3c06f8d
MD5 1f31362a8f26bacb032e9522d0ca5d43
BLAKE2b-256 6546dad6609be31796e92b09b71464c98b6122464d46e0d57f8af5eb987fd93f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page