jaraco / irc

Full-featured Python IRC library for Python.
MIT License
390 stars 84 forks source link

no colored or formatted text? #219

Open hazeyez opened 7 months ago

hazeyez commented 7 months ago

Hello,

I'm new at this, so please excuse me if this question is not conducive to the library - but is there a way to format IRC text with color and other schema with this library? Or do I have to import a separate library for that? (I found https://pypi.org/project/irccodes/ - for example)

If not possible with this library, it would be great to eventually incorporate that.

Thanks!

jaraco commented 6 months ago

As far as I know, no, this library doesn't provide any color or formatting support. I'd be happy for this library to host such behavior. Feel free to elaborate on how you'd like the feature to work or propose a patch (PR) to implement the behavior.

hazeyez commented 5 months ago

Thanks for the response. I do not quite know how this would be accomplished. But being that this is THE go-to python library for IRC, it only seems right that it have the ability to format IRC text with color, bold, italic, strikethrough, reset, underline, monospace, etc?

Importing another library can always be done and I've used https://pypi.org/project/irccodes/ in combination with your IRC library with success (some minor errors on syntax wherein the color codes uses single or double digit numbers, so it throws an error in the code if not formatted properly with the code that follows the color code.)

You don't tell a doctor how to do a doctor's work, so I recognize you could implement this better than me and I will leave the "how" up to you!

Let me know your thoughts!

jaraco commented 3 months ago

Can you say more about what it is you'd like to see? Are you wanting to add support for sending color codes or receiving them (or both)? Another way you could help is to write the documentation for the (yet unimplemented) feature, which could be used to infer what the behavior should be.

I've used https://pypi.org/project/irccodes/

Perhaps you could share what you've done before, perhaps as a link to another repo, as PR to the "examples" of this project, or as some code inline.

I recognize you could implement this better than me

I appreciate the respect, but unfortunately, I'm mostly a legacy maintainer of this project. I'm happy to keep it going and supported, but for new features, they'll have to come from the community (which in practice means the people who want features will have to implement them). This project is very much interested in accepting contributions, so now it's just a matter of finding someone willing to learn the code and devise an implementation.

ahopelesshadow commented 2 months ago

inside the bot code the user is writing they can simply do

from irccodes import colored

server.privmsg(event.target, colored(text="This text will be blue", color="blue"))

and thats it really. If jaraco wanted to integrate the code into the library, that wouldn't be that hard either, if you look at the source of irccodes on git, its quite simple, basically he would just need to include the source of it in his library, or simply create a new function accessible to the bot to just add the hex code to color the text being output. But importing irccodes is just as easy.