Ueland / VikingBot

Vikingbot is yet another simple PHP based IRC bot with support for plugins and secure IRC servers. The bot requires Unix/Linux shell access with PHP support and SSL support in PHP for use against secure IRC servers.
GNU General Public License v3.0
40 stars 6 forks source link

Announce text in colors #12

Closed renini closed 10 years ago

renini commented 10 years ago

Is it possible to announce text in colors? Especially just a few words? What i'm trying to accomplish is announce nagios warning/critical/ok's to our supportstaff channel, but i want those words, in orange,red,green.

Already tried \x03 and ^C03 styles, but so far without any luck.

Ueland commented 10 years ago

Hi!

I had to check but yes, it does work :)

I tested with the color codes used here (after some googling): http://tools.suckless.org/ii/bots

sendMessage($this->socket, $channel, $from.": \0034 Pong"); sendMessage($this->socket, $channel, $from.": \0038 Pong");

And these give me different colors for each row.

renini commented 10 years ago

Yeh i tought that that would work, but for me it doesn't work with the fileReaderOutput.db plugin for example. I think they get escaped? Or am i doing something wrong.

echo "\0034 Pong" > fileReaderOutput.db

Ueland commented 10 years ago

Hmm, i tested it now and got the same error.

I`l have to check it up a bit more tomorrow and see if i can figure out what the issue is.

renini commented 10 years ago

Did you find a method to fix this?

Ueland commented 10 years ago

Not yet, i did not get to check it yesterday. I am looking into it now, and if i dont see a quick solution, i will consider adding support for colors via some custom tags, like {red} or similiar , will that work for you?

renini commented 10 years ago

Oke cool np, yeh that works for me if it makes it possible to make selective words colorized. Or did you ment the complete sentence?

Ueland commented 10 years ago

it will colorize everything until a {normal} -tag appears, so you can easily colorize specific words.

renini commented 10 years ago

Sounds good

Ueland commented 10 years ago

Great, implementing it now :) Will update here when i have tested & pushed changes.

Ueland commented 10 years ago

Support for colors and bold/underline is now in place!

You can now do something like this: echo "Nagios: Service foo is {red}{bold}DOWN{reset} - CHECK IT UP" > db/fileReaderOutput.db

This will cause the DOWN-string to be bold and in red color.

renini commented 10 years ago

Just tested it, works! fnx :)

Ueland commented 10 years ago

Excellent :)