home *** CD-ROM | disk | FTP | other *** search
/ Dream 46 / Amiga_Dream_46.iso / Amiga / Internet / Irc / ChatBox1_164.lha / Rexx / Amiga.bot < prev    next >
Text File  |  1997-01-15  |  17KB  |  495 lines

  1. /* comment */
  2.  
  3. HOST = address()
  4.  
  5. address command
  6.  
  7. 'copy S:join.log RAM:'
  8.  
  9. address value HOST
  10.  
  11. options results
  12.  
  13. botnick = 'SASS'
  14. channame = '#ChatBoxTest'
  15. friends = 'S:ircrc.amiga'
  16. logfile = 'RAM:join.log'
  17.  
  18. a.CMD = 'NONE'
  19. command = 'NONE'
  20. rtc = 'none'
  21. quiet = 0
  22. toldme = 'I am allowed to talk.'
  23. opcnt = 0
  24. bancnt = 0
  25. kickcnt = 0
  26. kbcnt = 0
  27. faqcnt = 0
  28. tryme = 234
  29. joined = 0
  30.  
  31. CMD '/nick '||botnick
  32. CMD '/load '||friends
  33.  
  34. do while a.CMD ~= '/endrexx'
  35.  
  36.     WAIT STEM a.
  37.     command = upper(a.CMD)
  38.     if command == 'PRIVMSG' THEN
  39.         rtc = do_privmsg(channame)
  40.     else if command == 'JOIN' THEN
  41.         rtc = do_join()
  42.     else if command == 'INVITE' THEN
  43.         do
  44.             MATCH NICK a.NICK ADDRESS a.ADDRESS STEM info.
  45.             if info.ISMATCH == 1 THEN
  46.                 do
  47.                     if joined == 1 THEN
  48.                         CMD '/leave'
  49.                     CMD '/join '||a.LINE
  50.                 end
  51.             else
  52.                 CMD '/msg '||a.NICK||' You cannot invite me to another channel.'
  53.         end
  54.     else if command == 'KICK' THEN
  55.         do
  56.             if a.NICK == botnick THEN
  57.                 joined = 0
  58.             else nop
  59.         end
  60.     else if command == 'PART' THEN
  61.         do
  62.             if a.NICK == botnick THEN
  63.                 joined = 0
  64.             else nop
  65.         end
  66.     else if command == 'NICK' THEN
  67.         do
  68.             if a.NICK == botnick THEN
  69.                 botnick = a.LINE
  70.             else
  71.                 do
  72.                     if open('log', logfile, 'A') THEN
  73.                         writeln('log', a.NICK||' '||a.ADDRESS)
  74.                     err = close('log')
  75.                 end
  76.         end
  77.     if rtc == 'quit' then
  78.         do
  79.             CMD '/msg '||channame||' I am quitting now, '||a.NICK
  80.             CMD '/leave '||channame
  81.             CMD '/free fr'
  82.             CMD '/endrexx'
  83.             exit 0
  84.         end
  85.     else if rtc == 'leave' then
  86.         do
  87.             CMD '/msg '||channame||' I am leaving now, '||a.NICK
  88.             CMD '/leave '||channame
  89.         end
  90.     else if rtc ~= 'none' THEN
  91.         CMD '/msg '||rtc
  92.     else nop
  93. end
  94.  
  95. exit 0
  96.  
  97. do_privmsg: procedure expose a. quiet toldme opcnt bancnt kickcnt faqcnt tryme botnick friends logfile
  98.  
  99. cnt = a.TOKENS.COUNT
  100. ppl = 'people'
  101. comment = 'Yer outta here!'
  102. comment2 = ''
  103.  
  104. i = wordindex(a.LINE, 4)
  105. if i ~= 0 THEN
  106.     comment = substr(a.LINE, i);
  107.  
  108. i = wordindex(a.LINE, 3)
  109. if i ~= 0 THEN
  110.     comment2 = substr(a.LINE, i);
  111.  
  112. uline = a.LINE
  113. line = upper(a.LINE)
  114. chname = arg(1)
  115.  
  116. if upper(a.CHANNEL) == upper(a.NICK) THEN return 'none'
  117.  
  118. recip = a.CHANNEL
  119. if left(recip, 1) ~= '#' THEN
  120.     recip = a.NICK
  121.  
  122. if (word(line, 1) ~= botnick) & (recip == a.CHANNEL) THEN
  123.     do
  124.         if quiet == 1 then return 'none'
  125.         if pos('FUCK', line) ~= 0 THEN
  126.             return recip||' '||a.NICK||', you potty mouth.'
  127.         else if pos('ANYONE KNOW ', line) ~= 0 THEN
  128.             return recip||' '||a.NICK||', I know nothing.'
  129.         else if left(line, 4) == 'PING' THEN
  130.             return recip||' '||a.NICK||', PONG!!!'
  131.         return 'none'
  132.     end
  133.  
  134. faqline = 'NULL'
  135.  
  136. if recip == a.CHANNEL THEN
  137.     do
  138.         sasc = word(line, 2)
  139.         target = word(line, 3)
  140.         target2 = word(uline, 3)
  141.     end
  142. else
  143.     do
  144.         sasc = word(line, 1)
  145.         target = word(line, 2)
  146.         target2 = word(uline, 2);
  147.     end
  148.  
  149. if sasc == 'FAQ' THEN
  150.     do
  151.         if target == '' then return a.NICK||' : Format for FAQ:  FAQ <topic>'
  152.         else if target == 'LIST' THEN
  153.             do
  154.                 address                        /* address command */
  155.                 'cbdir >RAM:LIST.txt S:FAQS/'      /* save FAQ directory to RAM:LIST */
  156.  
  157.                 address                        /* address HOST again */
  158.                 if open('faqfile', 'RAM:LIST.txt') == 0 THEN
  159.                     faqline = 'FAQ LIST is unavailable, try again later..., '||a.NICK
  160.                 else
  161.                     do while eof('faqfile') ~= 1
  162.                         faqline = readln('faqfile')
  163.                         if length(faqline) > 1 THEN
  164.                             CMD '/msg '||recip||' '||faqline
  165.                     end
  166.                 return 'none'
  167.             end
  168.         else nop
  169.         if open('faqfile', 'S:FAQS/'||target) == 0 THEN
  170.             faqline = a.NICK||' : There is no FAQ for '||target||', or file is unavailable...'
  171.         else
  172.             do
  173.                 faq = readln('faqfile')
  174.                 faqline = readln('faqfile')
  175.             end
  176.         err = close('faqfile')
  177.         faqcnt = faqcnt + 1
  178.         return recip||' -=>'||faq||'<=- : '||faqline
  179.     end
  180. else if sasc == 'ADDFAQ' THEN
  181.     do
  182.         if target == '' | comment == 'Yer outta here!' THEN return a.NICK||' Missing parameters for ADDFAQ.'
  183.         MATCH NICK a.NICK ADDRESS a.ADDRESS STEM info.
  184.         if info.ISMATCH ~= 1 THEN
  185.             return a.NICK||' Your status is not high enough to add FAQs'
  186.         if exists('S:faqs/'||target2) THEN
  187.             return recip||' FAQ on >'||target2||'< is already on file.'
  188.  
  189.         if open('faqfile', 'S:faqs/'||target2, 'W') THEN
  190.             do
  191.                 writeln('faqfile', target2)
  192.                 writeln('faqfile', comment2)
  193.             end
  194.         err = close('faqfile');
  195.         return recip||' Faq on *>'||target2||'<* has been added'
  196.     end
  197. else if sasc == 'REMFAQ' THEN
  198.     do
  199.         if target == '' THEN return a.NICK||' Missing parameters for REMFAQ.'
  200.         MATCH NICK a.NICK ADDRESS a.ADDRESS STEM info.
  201.         if info.ISMATCH ~= 1 THEN
  202.             return a.NICK||' Your status is not high enough to remove FAQs'
  203.         if exists('S:faqs/'||target2) THEN
  204.             do
  205.                 address
  206.                 'delete >NIL: <NIL: S:faqs/'||target2
  207.                 address
  208.                 return recip||' FAQ on >'||target2||'< has been removed.'
  209.             end
  210.  
  211.         return recip||' There is no FAQ on *>'||target2||'<*'
  212.     end
  213. else if sasc == 'BAN' THEN
  214.     do
  215.         if target == '' then return a.NICK||' Missing parameter for BAN.'
  216.         MATCH NICK a.NICK ADDRESS a.ADDRESS STEM info.
  217.         if info.ISMATCH ~= 1 THEN
  218.             return a.NICK||' You do not have that access...'
  219.         else
  220.             do
  221.                 if pos('kb', info.STATUS) == 0 THEN
  222.                     return a.NICK||' You do not have that access...'
  223.                 else NOP
  224.                 bancnt = bancnt + 1
  225.                 kickcnt = kickcnt + 1
  226.                 if upper(target) == botnick THEN
  227.                     return chname||' Nice try, '||a.NICK
  228.                 NICKONCH NICK target CHANNEL chname VAR ison
  229.                 found=0
  230.                 if ison THEN
  231.                     do
  232.                         CMD '/deop '||chname||' '||target
  233.                         CMD '/ban '||chname||' '||target
  234.                         CMD '/kick '||chname||' '||target||' '||comment
  235.                     end
  236.                 else
  237.                     do
  238.                         if open('log', logfile, 'R') THEN
  239.                             do while eof('log') == 0 & found == 0
  240.                                 joiner = readln('log')
  241.                                 if upper(word(joiner, 1)) == target THEN
  242.                                     found = 1
  243.                             end
  244.                         if found THEN
  245.                             do
  246.                                 baddress = word(joiner, 2)
  247.                                 parse var baddress user'@'nix'.'d1
  248.                                 CMD '/ban '||chname||' *!*'user'@*.'||d1
  249.                             end
  250.                         err=close('log')
  251.                     end
  252.             end
  253.     end
  254. else if sasc == 'KICK' THEN
  255.     do
  256.         if target == '' then return a.NICK||' Missing parameter for KICK.'
  257.         MATCH NICK a.NICK ADDRESS a.ADDRESS STEM info.
  258.         if info.ISMATCH ~= 1 THEN
  259.             return a.NICK||' You do not have that access...'
  260.         else
  261.             do
  262.                 if pos('k', info.STATUS) == 0 THEN
  263.                     return a.NICK||' You do not have that access...'
  264.                 else NOP
  265.                 kickcnt = kickcnt + 1
  266.                 if upper(target) ~= botnick THEN
  267.                     CMD '/kick '||chname||' '||target||' '||comment
  268.                 else
  269.                     return chname||' Nice try, '||a.NICK
  270.             end
  271.     end
  272. else if sasc == 'OP' THEN
  273.     do
  274.         MATCH NICK a.NICK ADDRESS a.ADDRESS STEM info.
  275.         if info.ISMATCH ~= 1 THEN
  276.             return a.NICK||' You do not have that access...'
  277.         else
  278.             do
  279.                 if pos('c', info.STATUS) == 0 THEN
  280.                     return a.NICK||' You do not have that access...'
  281.                 else NOP
  282.             if target == '' THEN
  283.                 CMD '/op '||chname||' '||a.NICK
  284.             else if target ~= 'ME' THEN
  285.                 CMD '/op '||chname||' '||target
  286.             else if target == 'ME' THEN
  287.                 CMD '/msg '||a.NICK||' Use:  ''/msg SASS op'', or in the channel:  ''sass op'', the ''ME'' is no longer required.'
  288.             opcnt = opcnt + 1
  289.             end
  290.     end
  291. else if sasc == 'QUIET' THEN
  292.     do
  293.         MATCH NICK a.NICK ADDRESS a.ADDRESS STEM info.
  294.         if info.ISMATCH == 0 THEN return chname||' You cannot tell me what to do, '||a.NICK||'!!!'
  295.         quiet = 1
  296.         CMD '/msg '||chname||' I''ll be quiet, '||a.NICK
  297.         toldme = 'I was told to be quiet by '||a.NICK
  298.     end
  299. else if sasc == 'TALK' THEN
  300.     do
  301.         MATCH NICK a.NICK ADDRESS a.ADDRESS STEM info.
  302.         if info.ISMATCH == 0 THEN return chname||' You cannot tell me what to do, '||a.NICK||'!!!'
  303.         quiet = 0
  304.         CMD '/msg '||chname||' I''m ready to talk, '||a.NICK
  305.         toldme = 'I was allowed to talk by '||a.NICK
  306.     end
  307. else if sasc == 'STATUS' THEN
  308.     do
  309.         CMD '/msg '||recip||' '||toldme
  310.         if opcnt == 1 then ppl = 'person.'
  311.         else ppl = 'people.'
  312.         CMD '/msg '||recip||' I have opped '||opcnt||' '||ppl
  313.         if kickcnt == 1 then ppl = 'person.'
  314.         else ppl = 'people.'
  315.         CMD '/msg '||recip||' I have kicked '||kickcnt||' '||ppl
  316.         if bancnt == 1 then ppl = 'person.'
  317.         else ppl = 'people.'
  318.         CMD '/msg '||recip||' I have banned '||bancnt||' '||ppl
  319.         ppl = 'times.'
  320.         if faqcnt == 1 then ppl = 'time.'
  321.         else ppl = 'times.'
  322.         CMD '/msg '||recip||' I''ve been asked for FAQs '||faqcnt||' '||ppl
  323.     end
  324. else if sasc == 'SVIEW' THEN
  325.     do
  326.         personal = 0
  327.         if target == '' THEN
  328.             do
  329.                 target = a.NICK
  330.                 personal = 1
  331.             end
  332.         notfound = 1
  333.         target = upper(target)
  334.         if open('frndfile', friends) THEN
  335.             do while eof('frndfile') ~= 1
  336.                 faqline = readln('frndfile')
  337.                 faq = word(faqline, 4)
  338.                 faq2 = upper(faq)
  339.                 if faq2 == target THEN
  340.                     do
  341.                         notfound = 0
  342.                         if personal THEN
  343.                             CMD '/msg '||a.NICK||' Status for '||faq||' ('||word(faqline, 3)||') is '||word(faqline, 2)
  344.                         else
  345.                             CMD '/msg '||a.NICK||' Status for '||faq||' ('||word(faqline, 3)||') is '||word(faqline, 2)
  346.                     end
  347.             end
  348.         err = close('frndfile')
  349.         if notfound THEN
  350.             CMD '/msg '||a.NICK||' Status for '||a.NICK||' ('||a.ADDRESS||') is <unset>'
  351.     end
  352. else if sasc == 'TRYME' THEN
  353.     do
  354.         tryme = random(1, 10)
  355.         if tryme == 5 THEN
  356.             do
  357.                 CMD '/me takes aim at '||a.NICK||' -=<*POP*>=-'
  358.                 CMD '/kick '||a.NICK||' RIGHT in the head...'
  359.             end
  360.         else
  361.             do
  362.                 CMD '/me takes aim at '||a.NICK||' <<fizzle>>'
  363.                 CMD '/msg '||chname||' '||a.NICK||', you lucky dog!'
  364.             end
  365.     end
  366. else if sasc == 'HUG' THEN
  367.     do
  368.         if target == '' THEN return a.NICK||' Missing parameter for HUG.'
  369.         if recip == a.CHANNEL THEN
  370.                 target = word(uline, 3)
  371.         else
  372.                 target = word(uline, 2)
  373.         CMD '/me *H*U*G*S* '||target||' for '||a.NICK||'.'
  374.     end
  375. else if sasc == 'ADD' THEN
  376.     do
  377.         if target == '' THEN return a.NICK||' Missing parameter for ADD.'
  378.         MATCH NICK a.NICK ADDRESS a.ADDRESS STEM info.
  379.         if info.ISMATCH == 0 THEN return a.NICK||' You do not have that access.'
  380.         if pos('a', info.STATUS) == 0 THEN return a.NICK||' You do not have access to the ADD command.'
  381.         if recip == a.CHANNEL THEN i=3
  382.         else i=2
  383.         target = word(uline, i)
  384.         addr = word(uline, i+1)
  385.         modes = word(uline, i+2)
  386.         if addr == '' THEN return a.NICK||' Missing parameter for ADD.'
  387.         CMD '/chop '||target||' '||addr
  388.         CMD '/msg '||target||' Your level has been increased to access: +c'||modes
  389.         if modes == '' THEN return 'none'
  390.         CMD '/chg '||target||' +'||modes
  391.         if open('ffile', friends, 'A') THEN
  392.             writeln('ffile', '/add +c'||modes||' *!*'||addr||' '||target)
  393.         else nop
  394.         err = close('ffile')
  395.     end
  396. else if sasc == 'INVITE' THEN
  397.     do
  398.         MATCH NICK a.NICK ADDRESS a.ADDRESS STEM info.
  399.         if info.ISMATCH == 1 THEN
  400.             CMD '/invite '||a.NICK||' '||chname
  401.         else if quiet == 0 THEN
  402.             do
  403.                 CMD '/msg '||chname||' '||a.NICK||' would like to be invited.'
  404.                 CMD '/msg '||a.NICK||' I can''t invite you, I have asked the others...'
  405.             end
  406.         else
  407.             return a.NICK||' I was told to be quiet, so I cannot invite you, nor tell others to.'
  408.     end
  409. else if sasc == 'QUIT' THEN return 'quit'
  410. else if sasc == 'LEAVE' THEN return 'leave'
  411. else if sasc == 'UPDATE' THEN
  412.     do
  413.         if left(recip, 1) == '#' THEN return 'none'
  414.         if word(uline, 2) ~= 'betacbaccess' THEN return 'none'
  415.         towho = upper(a.NICK)
  416.         if pos('KLIF', towho) THEN
  417.             cbvers = 'Work:S_ChatBox/updates/ChatBox030-30'
  418.         else if pos('CAPPY', towho) THEN
  419.             cbvers = 'Work:S_ChatBox/updates/ChatBox030-41'
  420.         else if pos('FASTLANE', towho) THEN
  421.             cbvers = 'Work:S_ChatBox/updates/ChatBox030-30'
  422.         else if pos('ROBR', towho) THEN
  423.             cbvers = 'Work:S_ChatBox/updates/ChatBox030-30'
  424.         else if pos('SKYGUY', towho) THEN
  425.             cbvers = 'Work:S_ChatBox/updates/ChatBox030-41'
  426.         else if pos('SAIFUL', towho) THEN
  427.             cbvers = 'Work:S_ChatBox/updates/ChatBox000-40'
  428.         else if pos('JTW', towho) THEN
  429.             cbvers = 'Work:S_ChatBox/updates/ChatBox000-41'
  430.         else if pos('DARIUS', towho) THEN
  431.             cbvers = 'Work:S_ChatBox/updates/ChatBox030-41'
  432.         else if pos('CAMELOT', towho) THEN
  433.             cbvers = 'Work:S_ChatBox/updates/ChatBox030-41'
  434.         else if pos('FONEMAN', towho) THEN
  435.             cbvers = 'Work:S_ChatBox/updates/ChatBox030-41'
  436.         else if pos('AK', towho) THEN
  437.             cbvers = 'Work:S_ChatBox/updates/ChatBox030-41'
  438.         else if pos('SASCMAN', towho) THEN
  439.             do
  440.                 CMD '/msg '||a.NICK||' it will work...'
  441.                 return 'none'
  442.             end
  443.         else return 'none'
  444.         CMD '/dcc send '||a.NICK||' '||cbvers
  445.     end
  446. else if sasc == 'CBVERS' THEN
  447.     return a.NICK||' Current version is 1.125 Beta'
  448. else if sasc == 'KISS' THEN
  449.     return chname||' '||a.NICK||', you wish!'
  450. else if sasc == 'DANCE' THEN
  451.     CMD '/me swings '||a.NICK||' around, launching him out the window!'
  452. else if sasc == 'SWIM' THEN
  453.     CMD '/me can''t swim yet...  I''m young, and only written in ARexx...'
  454. else if sasc == 'BITEME' THEN
  455.     CMD '/me BITES '||a.NICK
  456. else if sasc == 'BITE' THEN
  457.     CMD '/me BITES '||a.NICK
  458. else if sasc == 'FUCK' THEN
  459.     CMD '/msg '||chname||' '||a.NICK||', into machinery, eh?  ;)'
  460. else if sasc == 'SPANK' THEN
  461.     CMD '/me takes '||a.NICK||' over his knee, and spanks the hell out of him.'
  462. else if sasc == 'BLOW' THEN
  463.     return chname||' Into ''auto'' erotica, eh, '||a.NICK||'?'
  464. else if sasc == 'SMILE' THEN
  465.     CMD '/me smiles at '||a.NICK
  466. else if sasc == 'SING' THEN
  467.     CMD '/me sings ''I heard it through the ChatBox'' for '||a.NICK||' ;)'
  468. else if sasc == 'BURP' THEN
  469.     do
  470.         CMD '/me *BURPS* a wild one...'
  471.         return chname||' Excuse me!  =-\'
  472.     end
  473. else if sasc == 'FART' THEN
  474.         CMD '/me *SNIFFS*, ew, burning plastic...'
  475. else nop
  476.  
  477. return 'none'
  478.  
  479. do_join: procedure expose joined a. botnick channame logfile
  480.  
  481. if a.NICK == botnick THEN
  482.     do
  483.         joined = 1
  484.         channame = a.LINE
  485.         CMD '/friends who'
  486.     end
  487. else
  488.     do
  489.         if open('log', logfile, 'A') THEN
  490.             writeln('log', a.NICK||' '||a.ADDRESS)
  491.         err = close('log')
  492.     end
  493.  
  494. return 'none'
  495.