Advertisement
Guest User

Ford_Lawnmower/UrbanDictionary Edit No-Colors No-Author No-Example

a guest
Jan 9th, 2011
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.93 KB | None | 0 0
  1. ;Urban Dictionary Script by Ford_Lawnmower irc.GeekShed.net #Script-Help
  2. menu Channel,Status {
  3. .$iif($group(#Slang) == On,$style(1)) Slang Trigger
  4. ..$iif($group(#Slang) == On,$style(2)) On: .enable #Slang
  5. ..$iif($group(#Slang) == Off,$style(2)) Off: .disable #Slang
  6. ..Add Badwords: {
  7. if (!$hget(censored)) { hmake censored 5 }
  8. $?="Enter the badword"
  9. if ($!) {
  10. if (!$hfind(censored,$!).data) {
  11. hadd censored $calc($hget(censored,0).item + 1) $!
  12. echo -a $! added to badword list
  13. }
  14. else { echo -a $! is already in my database. }
  15. }
  16. }
  17. ..Delete Badwords: {
  18. $?="Enter the bad word or the item number!"
  19. if ($!) {
  20. if ($! isnum) && ($hget(censored,$!)) {
  21. echo -a $hget(censored,$!) was deleted!
  22. hdel censored $!
  23. halt
  24. }
  25. if ($! isalpha) && ($hfind(censored,$!).data) {
  26. echo -a $! has been deleted from my database!
  27. hdel censored $hfind(censored,$!).data
  28. }
  29. else { echo -a Can't find $! in my database. Try checking the list. }
  30. }
  31. }
  32. ..List Badwords:censored.list
  33. }
  34. #Slang on
  35. On $*:Text:/^(\+|-|!|@)Slang.*/Si:#: {
  36. var %action $regml(1)
  37. if (%action isin +-) && ($regex($nick($chan,$nick).pnick,/(!|~|&|@)/)) {
  38. if (%action == +) {
  39. if ($istok(%SlangChanList,$+($network,$chan),32)) { .msg $chan $nick $chan is already running the Slang script }
  40. else {
  41. .enable #Slang
  42. Set %SlangChanList $addtok(%SlangChanList,$+($network,$chan),32)
  43. .msg $chan $nick has activated the Slang script for $chan .
  44. }
  45. }
  46. else {
  47. if (!$istok(%SlangChanList,$+($network,$chan),32)) { .msg $chan $nick $chan is not running the Slang script }
  48. else {
  49. Set %SlangChanList $remtok(%SlangChanList,$+($network,$chan),1,32)
  50. .msg $chan $nick has deactivated the Slang script for $chan .
  51. }
  52. }
  53. }
  54. elseif (!$timer($+(Slang,$network,$nick))) && ($istok(%SlangChanList,$+($network,$chan),32)) {
  55. .timer $+ $+(Slang,$network,$nick) 1 6 noop
  56. var %method $iif(%action == !,.notice $nick,$iif($regex($nick($chan,$nick).pnick,/(!|~|&|@|%|\+)/),.msg $chan,.notice $nick))
  57. GetSlang %method $2-
  58. }
  59. }
  60. #Slang end
  61. alias slang { GetSlang echo -a $1- }
  62. alias -l GetSlang {
  63. var %sockname $+(SlangUD,$network,$2,$ticks)
  64. var %SlangUD.url $iif($3,$replace($+(/define.php?page=,$iif($ceil($calc($3 / 7)),$v1,1),&term=,$iif($3 !isnum,$3-,$4-)),$chr(32),+),/random.php)
  65. sockopen %sockname www.urbandictionary.com 80
  66. sockmark %sockname $1-2 %SlangUD.url $iif($3 isnum,$iif($calc($3 % 7),$v1,7),1) 0 0
  67. }
  68. On *:sockopen:SlangUD*: {
  69. if (!$sockerr) {
  70. sockwrite -nt $sockname GET $gettok($sock($sockname).mark,3,32) HTTP/1.1
  71. sockwrite -n $sockname Host: www.urbandictionary.com
  72. sockwrite -n $sockname $crlf
  73. }
  74. else { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
  75. }
  76. On *:sockread:SlangUD*: {
  77. if ($sockerr) { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
  78. else {
  79. var %SlangUD | sockread %SlangUD
  80. if (Location: http://www.urbandictionary.com/define.php?term isin %SlangUD) {
  81. GetSlang $gettok($sock($sockname).mark,1-2,32) 1 $gettok(%SlangUD,-1,61)
  82. sockclose $sockname
  83. return
  84. }
  85. if (<div id='not_defined_yet'> isin %SlangUD) { $gettok($sock($sockname).mark,1-2,32) Sorry that word has yet to be defined. }
  86. if (<td class='index'> isin %SlangUD) { sockmark $sockname $puttok($sock($sockname).mark,$calc($gettok($sock($sockname).mark,5,32) + 1),5,32) }
  87. if ($gettok($sock($sockname).mark,5,32) == $gettok($sock($sockname).mark,4,32)) {
  88. if ($gettok($sock($sockname).mark,6,32) == word && $httpstrip(%SlangUD)) {
  89. if (<span style='font-weight: normal'> !isin %SlangUD) { $gettok($sock($sockname).mark,1-2,32) Word $censored($httpstrip(%SlangUD)) }
  90. sockmark $sockname $puttok($sock($sockname).mark,0,6,32)
  91. }
  92. if ($regex(%SlangUD,/<div class=['"]([^>]*)['"]>/)) { sockmark $sockname $puttok($sock($sockname).mark,$regml(1),6,32) }
  93. if ($gettok($sock($sockname).mark,6,32) == definition && $regex(def,%SlangUD,/<div class="definition">(.*)<div class="example">(.*)<\/div>/)) {
  94. put $gettok($sock($sockname).mark,1-2,32) Definition $censored($replace($httpstrip($regml(def,1)),$chr(13),$chr(32)))
  95. ;put $gettok($sock($sockname).mark,1-2,32) 06Example -04 $censored($replace($httpstrip($regml(def,2)),$chr(13),$chr(32)))
  96. }
  97. if ($gettok($sock($sockname).mark,6,32) == example && $httpstrip(%SlangUD)) { ;put $gettok($sock($sockname).mark,1-2,32) 06Example -04 $censored($replace($v1,$chr(13),$chr(32))) }
  98. if (<a href="/author.php?author= isin %SlangUD) {
  99. ;put $gettok($sock($sockname).mark,1-2,32) 06Author -04 $censored($httpstrip(%SlangUD) - $+(07,http://www.urbandictionary.com,$gettok($sock($sockname).mark,3,32)))
  100. sockclose $sockname
  101. return
  102. }
  103. if (%SlangUD == <td class='word'>) { sockmark $sockname $puttok($sock($sockname).mark,word,6,32) }
  104. }
  105. }
  106. }
  107. alias -l httpstrip { var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x) | return $remove($replace(%x,&amp;,&,&quot;,",&gt;,>,&lt;,<),&nbsp;,&lt;) }
  108. alias -l Put {
  109. if (!$regex($1,/(\.|^)(msg|notice|echo)$/Si)) || (!$3) { echo -st **Put error** Syntax /Put msg #channel text - or - /Put notice nickname text | return }
  110. var %tokens $0, %Tstart 3, %Dtimer 1500
  111. if ($timer($+(Put,$2,$network)).secs) { %Dtimer = $calc($v1 * 1000) }
  112. while ($len($($+($,%Tstart,-,%tokens),2)) > 430) {
  113. dec %tokens
  114. if ($len($($+($,%Tstart,-,%tokens),2)) <= 430) {
  115. .timer -m 1 %Dtimer $1-2 $+(04,$($+($,%Tstart,-,%tokens),2)))
  116. inc %Dtimer 1500
  117. %Tstart = $calc(%tokens + 1)
  118. %tokens = $0
  119. }
  120. }
  121. .timer -m 1 %Dtimer $1-2 $+(04,$($+($,%Tstart,-,%tokens),2)))
  122. .timer $+ $+(Put,$2,$network) -m 1 $calc(%Dtimer + 1500) noop
  123. }
  124. alias censored {
  125. if (!$hget(censored)) { hmake censored 5 }
  126. var %censored.string = $1-, %censored.words = $gettok($1-,0,32)
  127. while %censored.words {
  128. if ($hfind(censored,$left($gettok(%censored.string,%censored.words,32),4) $+ *,1,w).data) || ($hfind(censored,$gettok(%censored.text,%censored.word,32)).data) {
  129. %censored.string = $replace(%censored.string,$gettok(%censored.string,%censored.words,32),!@#&)
  130. }
  131. dec %censored.words
  132. }
  133. return %censored.string
  134. }
  135. alias censored.list {
  136. var %censored.counter = $hget(censored,0).item
  137. while %censored.counter {
  138. echo -a $hget(censored,%censored.counter).item $hget(censored,%censored.counter).data
  139. dec %censored.counter
  140. }
  141. }
  142. On *:Unload: { hfree censored }
  143. On *:Start: {
  144. unset %UDChanList
  145. if (!$hget(censored)) { hmake censored 5 }
  146. if ($isfile(censored.hsh)) { hload censored censored.hsh }
  147. }
  148. On *:Exit: { if ($hget(censored)) { hsave censored censored.hsh } }
  149. On *:Disconnect: { if ($hget(censored)) { hsave censored censored.hsh } }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement