Skip to main content

Apply and strip formatting from IRC messages

Project description

ircstyle

ircstyle is a Python 3.7+ package for applying and stripping formatting from IRC messages. Its primary purpose is for use with Python based IRC bots.

cicd badge

Links

Caption Link
Repo https://github.com/impredicative/ircstyle/
Changelog https://github.com/impredicative/ircstyle/releases
Package https://pypi.org/project/ircstyle/
Donation BTC / LTC / ETH / DOGE

Usage

This package provides two primary methods, style and unstyle.

Style

This method is used to style text with IRC attribute and / or color codes.

import ircstyle

ircstyle.style('Hi there', fg='blue', bg='white', bold=True, italics=True, underline=True, reset=True)
'\x0302,00\x02\x1d\x1fHi there\x0f'

ircstyle.style('Hello World!', fg='green', reset=False)
'\x0303Hello World!'

ircstyle.style('ATTENTION!', bold=True, underline=True)
'\x02\x1fATTENTION!\x0f'

ircstyle.style('Something', bg=ircstyle.colors.teal)
'\x0301,10Something\x0f'

Unstyle

This method is used to strip all formatting control codes from IRC messages so that you can safely use the contents outside of IRC in a printable format.

import ircstyle

ircstyle.unstyle('\x02message\x0f')
'message'

ircstyle.unstyle('message')
'message'

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

ircstyle-0.1.5.tar.gz (5.3 kB view hashes)

Uploaded Source

Built Distribution

ircstyle-0.1.5-py3-none-any.whl (5.0 kB view hashes)

Uploaded Python 3

Supported by

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