I'm working on a simple irc bot in C#, and I can't figure out how to embed the typical mirc control codes for bold/color etc into string literals.
Can someone point me towards how to do this?
Join Stack Overflow to learn, share knowledge, and build your career.
|
|
The mIRC color code format is described here. I guess you're asking how to embed a ^C in a string. This is known as Caret notation. According to C0 and C1 control codes, ^C is:
Embedded in a string:
|
|||||||||||||
|
|
I create an enum and assign the hex values for the control codes to them.
|
|||||
|
|
In my Python IRC bot, I can get bold to show up in irssi using \x02sometext\x02, which shows up like:
this is some text As for colors, I believe you're looking for \x03AA,BB where A is the foreground color and B the background color (what you'd type in after Ctrl+K). Not 100% for sure, though. Try connecting an IRC client using telnet, and check what mIRC does when you use Ctrl+K. You're not likely to get a standard cohesive behavior across IRC clients...ANSI escape codes are processed by more of the old-fare staple Unix clients like irssi, and mIRC sometimes does its own thing. |
|||||||||||||
|
|
This might be down to the specific chat library I was using (ChatSharp), but I couldn't get the current accepted answer to work. What I ended up with was:
|
|||
|
|