Async IRC Client
Project description
AsyncIRCClient
Async (Twitch-) IRC client
First async code so takee everything with a bit of caution
Example usage
from async_irc_client.async_irc_client import TwitchIRCBot, Message
from loguru import logger
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__":
MyBot(oauth_token="YOURTOKEN", nick_name="BOTNAME", channel="CHANNELNAME").run()
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
AsyncIRCClient-0.0.8.tar.gz
(9.2 kB
view hashes)
Built Distribution
Close
Hashes for AsyncIRCClient-0.0.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6399fbeb709fe9aae9a5cb553d5a6248f043440fe3cd8cf5c300d73afcb48f8 |
|
MD5 | 01ea46d0b5ee69285a8d2e141e3d4adb |
|
BLAKE2b-256 | faf7b155e400adab72c95ceef95924099cd1b7bb87ab4058474817c7ef92cddc |