Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function FBSProcess( sz )
- {
- // This function is used to process the raw data that the bot is recieving from the irc server
- local raw = split( sz, "\r\n" ), a, z = raw.len(), line;
- for ( a = 0; a < z; a++ )
- {
- line = raw[ a ];
- local FBS_PING = GetTok( line, " ", 1 ), FBS_EVENT = GetTok( line, " ", 2 ), FBS_CHANEVENT = GetTok( line, " ", 3 ),
- Count = NumTok( line, " " ), Nick, Command, Prefix, Text;
- // The most important thing is making sure that the bot stays connected to IRC
- if ( FBS_PING ) FBS_BOT.Send( "PONG " + FBS_PING + "\n" );
- if ( FBS_EVENT == "001" )
- {
- if ( FBS_BOT )
- {
- // Identify the bot with services, comment this line if its not registered
- FBS_BOT.Send( "PRIVMSG NickServ IDENTIFY " + FBS_BPASS + "\n" );
- // Set it so that the network classes the bot as a bot
- FBS_BOT.Send( "MODE " + FBS_NICK + " +B\n" );
- // Make the bot join the specified channel
- FBS_BOT.Send( "JOIN " + FBS_CHAN + " " + FBS_CPASS + "\n" );
- // The bot now needs to collect information about users in the channel
- print( "Succesfully joined " + FBS_CHAN + "!" );
- }
- }
- else if ( FBS_EVENT == "KICK" )
- {
- FBS_BOT.Send( "JOIN " + FBS_CHAN + " " + FBS_CPASS + "\n" );
- }
- else if ( FBS_EVENT == "QUIT" )
- {
- FBS_BOT.Send( "JOIN " + FBS_CHAN + " " + FBS_CPASS + "\n" );
- }
- else if ( FBS_EVENT == "353" ) FBSSortNicks( sz );
- else if ( ( FBS_EVENT == "MODE" ) || ( FBS_EVENT == "NICK" ) || ( FBS_EVENT == "JOIN" ) || ( FBS_EVENT == "PART" ) || ( FBS_EVENT == "QUIT" ) ) FBS_BOT.Send( "NAMES :" + FBS_CHAN + "\n" );
- if ( FBS_CHANEVENT == FBS_CHAN )
- {
- // Grab the nick
- Nick = GetTok( line, "!", 1 ).slice( 1 );
- // Figure out what the command is
- Command = GetTok( line, " ", 4 );
- // Figure out what prefix was used
- Prefix = Command.slice( 1, 2 );
- Command = Command.slice( 1 );
- // Figure out the text after the command
- if ( NumTok( line, " " ) > 4 ) Text = GetTok( line, " ", 5, Count );
- else Command = split( Command, "\r\n" )[ 0 ];
- // Parse the command
- // Parse the command
- /*
- if ( ( Prefix == "!" ) && ( Count > 4 ) ) FBSIrcCommand( Nick, Command.tolower(), Text );
- else if ( ( Prefix == "!" ) && ( Count == 4 ) ) FBSIrcCommand( Nick, Command.tolower(), null );
- */
- if (Nick && Command && Text) { FBSIrcCommand( Nick, Command, Text ); }
- else if (Nick && Command) { FBSIrcCommand( Nick, Command, null ); }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement