1

I'm fairly new to the twisted event driven programming in Python. I've made a basic bot with some fun functions and now I would like to expand by sending back colored text if a certain event triggers. I understand that some sort of encoding(?) has to take place, but other than that I have no clue where to begin.

How can I encode a string so that it appears as a colored message in most popular IRC clients such as irssi or mIRC?

Em Bq
  • 55
  • 7

2 Answers2

0

You can use the assembleFormattedText API in Twisted, which specifically mentions mIRC color codes.

Glyph
  • 31,152
  • 11
  • 87
  • 129
0

You just need to send PRIVMSG or notice with the correct formatting.

Sending ASCII \3 followed by foreground,background colours will have the desired result. There are 15 standard foreground and background colours defined by most clients such as mIRC, HexChat etc.

For example:

PRIVMSG #channel :\35,3

\2 toggles bold, and \1 enables and disables underline.

This is partially already answered here: Embed mIRC Color codes into a C# literal?, the basic string format is always the same regardless of programming language.

Community
  • 1
  • 1
braindigitalis
  • 524
  • 7
  • 19