IRC does not limit you to using plain text. Add
extra formatting, such as underlining and italics, to your
though most IRC clients support color, simpler formatting can
sometimes be more effective. Too much use of color tends to annoy
people. In such circumstance, channel operators have at their
disposal the option of banning the use of color. If this happens, it
will still be possible to send messages with simpler formatting. To
highlight a particular word in a message, you could underline it. To
catch somebody's attention, you could make your
message bold. To emphasize something, you could make it italic. All
of these options are possible, regardless of channel restrictions.
Formatting Text in mIRC
mIRC lets you view and send formatted
text. Many other IRC clients behave in similar ways. Three main types
of text formatting are available from mIRC. All of these can be
accessed by keyboard shortcuts. These styles are complementary, so
you can make text both bold and underlined, for example.
When composing a line or message, the text can
be formatted as bold by pressing Ctrl-B. You will see a control
character appear in your message. Anything you type after this will
appear in bold. You will not see the result of this until you
actually send your message to the server.
You can underline part of your message by
pressing Ctrl-U. This will cause a control character to be inserted
into your message. Everything after this character will be
Italic or reversed
Italic text can also be used. However, because
some clients are incapable of rendering italic text, you will find
that most clients (including those that can
render italic text) display this as normal text with the background
and foreground colors swapped. For this reason, it is also known as
reversed text formatting and can be achieved in mIRC by pressing
To return text to its unformatted state,
press Ctrl-O. This removes all formatting, even if more than one
style has been applied.
Combinations of these options are illustrated in .
Figure 1. Combinations of formatting rendered by mIRC
Formatting Text with a Bot
Formatting text with the aforementioned
attributes is simpler than applying colors, as only one control
character is required for each style. There are no parameters to add
after each style character.
Bold text can be achieved by prefixing
the text with ASCII character 0x02, which can be
represented in Unicode as \u0002. The following
Java code creates a bold IRC message:
String bold = "\u0002This is bold";
Text can be underlined with ASCII character
0x1F, which can be represented in Unicode as
String underlined = "\u001FThis is underlined";
Italic or reversed
Italic or reversed text is formatted with ASCII
character 0x16, or Unicode character
String reversed = "\u0016This is reversed";
To remove all formatting from a message, use
ASCII character 0x0F, or Unicode character
\u000F. Any text after this point in the message
will return to its normal state, unless other formatting characters
are applied again.
String mixture = "\u0002Bold\u000F and gone";
Formatting Text with PircBot
Colors class in the PircBot Java IRC API contains useful constants,
not only for coloring, but also for formatting text with these
styles. Using these is probably easier than remembering the Unicode
String bold = Colors.BOLD + "This is bold";
String underlined = Colors.UNDERLINE + "This is underlined";
String reversed = Colors.REVERSE + "This is reversed";
String mixture = Colors.BOLD + "Bold" + Colors.NORMAL + " and gone";
Just because you can use formatting doesn't mean you
have to. Remember to use it sparingly and only when necessary,
otherwise you'll start to annoy people and they may
start ignoring you!
Some of the bots covered later in this book use bold formatting to
make parts of messages stand out more clearly.
© 2007 O'Reilly Media, Inc.
| Customer Service:
| Book issues:
All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners.