Advertisement
Guest User

Untitled

a guest
Jun 1st, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 2.50 KB | None | 0 0
  1. function FBSProcess( sz )
  2. {
  3.     // This function is used to process the raw data that the bot is recieving from the irc server 
  4.   local raw = split( sz, "\r\n" ), a, z = raw.len(), line;
  5.    
  6.     for ( a = 0; a < z; a++ )
  7.     {
  8.         line = raw[ a ];
  9.        
  10.         local FBS_PING = GetTok( line, " ", 1 ), FBS_EVENT = GetTok( line, " ", 2 ), FBS_CHANEVENT = GetTok( line, " ", 3 ),
  11.         Count = NumTok( line, " " ), Nick, Command, Prefix, Text;
  12.  
  13.         // The most important thing is making sure that the bot stays connected to IRC
  14.         if ( FBS_PING ) FBS_BOT.Send( "PONG " + FBS_PING + "\n" );
  15.        
  16.         if ( FBS_EVENT == "001" )
  17.         {
  18.             if ( FBS_BOT )
  19.             {
  20.                 // Identify the bot with services, comment this line if its not registered
  21.                 FBS_BOT.Send( "PRIVMSG NickServ IDENTIFY " + FBS_BPASS + "\n" );
  22.                 // Set it so that the network classes the bot as a bot
  23.                 FBS_BOT.Send( "MODE " + FBS_NICK + " +B\n" );
  24.                 // Make the bot join the specified channel
  25.                 FBS_BOT.Send( "JOIN " + FBS_CHAN + " " + FBS_CPASS + "\n" );
  26.                 // The bot now needs to collect information about users in the channel
  27.                 print( "Succesfully joined " + FBS_CHAN + "!" );
  28.             }
  29.         }
  30.        
  31.         else if ( FBS_EVENT == "KICK" )
  32.         {
  33.         FBS_BOT.Send( "JOIN " + FBS_CHAN + " " + FBS_CPASS + "\n" );
  34.         }
  35.  
  36.         else if ( FBS_EVENT == "QUIT" )
  37.         {
  38.         FBS_BOT.Send( "JOIN " + FBS_CHAN + " " + FBS_CPASS + "\n" );
  39.         }
  40.         else if ( FBS_EVENT == "353" ) FBSSortNicks( sz );
  41.         else if ( ( FBS_EVENT == "MODE" ) || ( FBS_EVENT == "NICK" ) || ( FBS_EVENT == "JOIN" ) || ( FBS_EVENT == "PART" ) || ( FBS_EVENT == "QUIT" ) ) FBS_BOT.Send( "NAMES :" + FBS_CHAN + "\n" );
  42.         if ( FBS_CHANEVENT == FBS_CHAN )
  43.         {
  44.             // Grab the nick
  45.             Nick = GetTok( line, "!", 1 ).slice( 1 );
  46.             // Figure out what the command is
  47.             Command = GetTok( line, " ", 4 );
  48.             // Figure out what prefix was used
  49.             Prefix = Command.slice( 1, 2 );
  50.             Command = Command.slice( 1 );
  51.            
  52.           // Figure out the text after the command
  53.           if ( NumTok( line, " " ) > 4 ) Text = GetTok( line, " ", 5, Count );
  54.           else Command = split( Command, "\r\n" )[ 0 ];
  55.           // Parse the command
  56.           // Parse the command
  57.           /*
  58.           if ( ( Prefix == "!" ) && ( Count > 4 ) ) FBSIrcCommand( Nick, Command.tolower(), Text );
  59.           else if ( ( Prefix == "!" ) && ( Count == 4 ) ) FBSIrcCommand( Nick, Command.tolower(), null );
  60.           */
  61.           if (Nick && Command && Text) { FBSIrcCommand( Nick, Command, Text ); }
  62.           else if (Nick && Command) { FBSIrcCommand( Nick, Command, null ); }
  63.         }
  64.  
  65.     }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement