Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any way to handle message formatting? (colors etc.) #75

Open
la55u opened this issue Jun 9, 2018 · 2 comments
Open

Any way to handle message formatting? (colors etc.) #75

la55u opened this issue Jun 9, 2018 · 2 comments

Comments

@la55u
Copy link

la55u commented Jun 9, 2018

Maybe I'm missing something but currently I can't seem to figure out how to get the messages without the leftover from the formatting. All I did was adding a print(message) line to the 'Basic Usage' example's on_message method and enter a channel that's full of formatting. Here's the output:
https://i.imgur.com/kqRVlmG.png
It does leave the color codes in the message. For example the 04 is red etc. What should I do to get only the plain text message without any type of formatting? (colors, bold, italic etc.)

I found an answer elsewhere on how to strip the colors, but I'm not sure where to apply it:
regex = re.compile("\x1f|\x02|\x12|\x0f|\x16|\x03(?:\d{1,2}(?:,\d{1,2})?)?", re.UNICODE)

Thank you.

@shizmob
Copy link
Owner

shizmob commented Aug 5, 2018

Given that regexp, you'd run message = regex.sub(message, '') on the message. I'm not sure if we want to support complete message stripping like that in Pydle itself, however.

@theunkn0wn1
Copy link
Collaborator

theunkn0wn1 commented Dec 24, 2018

I don't believe its Pydle's job to strip color formatting from incoming IRC messages, though it can be relatively easily implementable as a service function.

I believe the implementation of such behavior should be differed to your bot's implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants