Better user input filtering for a bot?

un dead <[email protected]> Sat, 12 Feb 2011 13:42:52 -0500
Newsgroups gmane.network.irc.irssi.user
Message-ID <[email protected]>
I have an irssi bot here (2 clause BSD licensed):

https://github.com/undeadzy/wraithbot

I use it for responding to requests for information about Urban Terror
servers, reporting top clans in servers, rcon for quake3 style
servers, TS3 server API and wrapper, and miscellaneous info.  It's
running in a couple channels on irc.gamesurge.net including #ftwgl.

Anyway, I need a better filter function for user input.  Does anyone
have something that I could use (FreeBSD license compatible)?  I want
to accept as much user information as possible without making the bot
vulnerable.  For instance, it has to filter newlines just in case an
user somehow inserts one because that can cause it to insert commands.
 The problem is that I don't know all of the possible vulnerable
character sequences for irssi.  Newline appears to be one.  You could
consider color/formatting another since it can break what I try to do.
 I would like to add a module to keep user added quotes or key/value
definitions.  I'm filtering too much right now for either of those.

My second question: is there a better way to print out information
quickly?  The messages tend to be delayed due to what I assume is IRC
command flooding protection.  I'm only trying to print out usually 4-5
lines but they get delayed.  I'm using one send_message per line right
now.  I need something for a lot of information at once (say querying
settings in a server where I get a lot of info at once) and also for
timely information (I'll get info from NA servers quicker than Euro
servers.  Should I print out as fast as I can or queue it up?)