Guest User

twitch bot script for error checking

a guest
Oct 23rd, 2014
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.28 KB | None | 0 0
  1. on *:TEXT:!commands:#: {
  2. if ((%floodcommands) || ($($+(%,floodcommands.,$nick),2))) { return }
  3. set -u10 %floodcommands On
  4. set -u30 %floodcommands. $+ $nick On
  5. msg $chan $nick list of custom commands: 1. !donate - donation info 2. !directdonate - direct donation info 3. !rules - rules... duh! 4. !sunday - Sunday info 5. !mods - shows how many and who the mods are in chat 6. !twitter - twitter info 7. !youtube - youtube info
  6. }
  7. on *:TEXT:!modcommands:#: {
  8. if ((%floodmodcommands) || ($($+(%,floodmodcommands.,$nick),2))) {return}
  9. set -u10 %floodmodcommands on
  10. set -u30 %floodmodcommands. $+ $nick On
  11. msg $chan $nick list of moderator commands: 1. !poll - starts a straw poll 2. !startannounce - starts announcements 3. !stopannounce - stops announcements 4. !points add/remove x - adds or removes x ammount of points 5. !permit - permit a certain user to post links
  12. }
  13. on *:TEXT:!donate:#: {
  14. if ((%flooddonate) || ($($+(%,flooddonate.,$nick),2))) { return }
  15. set -u10 %flooddonate On
  16. set -u30 %flooddonate. $+ $nick On
  17. msg $chan $nick thanks for your interest in donating! Please follow the link to donate! It's very much appreciated! https://www.twitchalerts.com/donate/13mknight
  18. }
  19. on *:TEXT:!donatebc:#: {
  20. if ((%flooddonatebc) || ($($+(%,flooddonatebc.,$nick),2))) { return }
  21. set -u10 %flooddonatebc On
  22. set -u30 %flooddonatebc. $+ $nick On
  23. msg $chan $nick thanks for your interest in donating for Breast Cancer. You can type !donate for a link to donate to me to help support the channel. On sundays in october I donate 80% of everything donated to me to breast cancer research, or you can follow this link to donate directly to the cause! https://www.nationalbreastcancer.org/breast-cancer-donations
  24. }
  25. on *:TEXT:rules:#: {
  26. if ((%floodrules) || ($($+(%,floodrules.,$nick),2))) { return }
  27. set -u10 %floodrules On
  28. set -u30 %floodrules. $+ $nick Onmsg $chan $nick the rules here are simple so I expect everyone to follow them! - No spamming chat - No offensive language (be respectful) -Have Fun
  29. }
  30. on *:TEXT:!sunday:#: {
  31. if ((%floodsunday) || ($($+(%,floodsaunday.,$nick),2))) { return }
  32. set -u10 %floodsunday On
  33. set -u30 %floodsunday. $+ $nick On
  34. msg $chan $nick what are my Sunday Scare Streams for Breast Cancer you ask?? Well good question! Every Sunday in October I host a 4-6 hour live stream. 80% of all donations received during this time will be donated by me live toward breast cancer research and development. Alternatively you can just donate directly to the same foundation for breast cancer that I donate to! However, donating to me and letting me donate to them helps me out as I keep 20% to keep the streams going!
  35. }
  36. on *:TEXT:!twitter:#: {
  37. if ((%floodtwitter) || ($($+(%,floodtwitter.,$nick),2))) { return }
  38. set -u10 %floodtwitter On
  39. set -u30 %floodtwitter. $+ $nick On
  40. msg $chan $nick if you live what you see be sure to follow me on Twitter for stream times and upates! https://twitter.com/13mknight
  41. }
  42. on *:TEXT:!youtube:#: {
  43. if ((%floodyoutube) || ($($+(%,floodyoutube.,$nick),2))) { return }
  44. set -u10 %floodyoutube On
  45. set -u30 %floodyoutube. $+ $nick On
  46. msg $chan $nick if you like what I'm doing here please feel free to subscribe to my Youtube for past streams. Also if you miss a stream you can catch it there a few days later! https://www.youtube.com/user/The13mknight
  47. }
  48. on *:TEXT:hello:#: {
  49. if ((%floodhello) || ($($+(%,floodhello.,$nick),2))) { return }
  50. set -u10 %floodhello On
  51. set -u30 %floodhello. $+ $nick On
  52. msg $chan Hello $nick Thanks for joining us!
  53. }
  54.  
  55.  
  56.  
  57. on *:TEXT:!startannounce:#: {
  58. if ($nick isop #) {
  59. msg $chan announcements are now running.
  60. .timerLinks 0 600 .play # C:\Users\Michael\Desktop\announcements.txt
  61. }
  62. }
  63. on *:TEXT:!stopannounce:#: {
  64. if ($nick isop #) {
  65. msg $chan announcements have now stopping.
  66. .timerLinks off
  67. }
  68. }
  69.  
  70. on !*:text:*:#:{
  71. if ($nick isop #) { return }
  72. if ( $len($1-) >= 10 ) {
  73. if ( $calc($regex($1-,/[A-Z]/g) / $regex($1-,/[A-Z]/gi) * 100) >= 70 ) {
  74.  
  75. ; check if user is not warned yet
  76. if !$istok(%caps.warned,$nick,32) {
  77.  
  78. ; warning user
  79. msg $chan $nick -> stop typing in caps! [warning]
  80.  
  81. ; add user to %caps.warned, so we can check it later
  82. set -e %caps.warned $addtok(%caps.warned,$nick,32)
  83.  
  84. ; set timer to remove user from %caps.warned after 300s
  85. .timer 1 300 remove.warned $nick
  86. }
  87. else {
  88. ; so user is already warned..
  89. ; place your timeout command here
  90. }
  91. }
  92. }
  93. }
  94.  
  95. alias -l remove.warned {
  96. set -e %caps.warned $remtok(%caps.warned,$1,1,32)
  97. }
  98.  
  99.  
  100. on *:text:!poll *:#:{
  101. var %regex = /(?:(.+?)\s*[:-]+\s*|())(.+?)$/iS
  102. if ($regex($strip($2-),%regex)) {
  103. var %title = $iif($regml(1),$v1,Poll)
  104. var %options = $regsubex($regml(2),/\s* $+ $chr(44) $+ \s*/g,$chr(44))
  105. }
  106. else return
  107.  
  108. noop $strawpoll.create(#,%title,%options)
  109. }
  110.  
  111. alias strawpoll.create {
  112. var %chan = $1, %title = $urlencode($2), %options
  113. var %multi = true, %permissive = false
  114.  
  115. var %i = 1, %n = $numtok($3,44)
  116. while (%i <= %n) {
  117. %options = %options $+ &options[]= $+ $urlencode($gettok($3,%i,44))
  118. inc %i
  119. }
  120.  
  121. var %sockname = strawpoll. $+ $ticks
  122. hfree -w %sockname | hmake %sockname
  123. hadd %sockname headerfile %sockname $+ .header.txt
  124. hadd %sockname datafile %sockname $+ .data.txt
  125.  
  126. hadd %sockname host strawpoll.me
  127. hadd %sockname request /ajax/new-poll
  128. hadd %sockname method POST
  129. hadd %sockname data $+(title=,%title,%options,&multi=,%multi,&permissive=,%permissive)
  130. hadd %sockname signal strawpoll.create
  131. hadd %sockname params %chan
  132.  
  133. sockopen %sockname $hget(%sockname,host) 80
  134. }
  135.  
  136. on *:signal:strawpoll.create:{
  137. var %err = $1, %sockname = $2, %header = $3, %data = $4, %chan = $5
  138.  
  139. if (* 200 OK iswm $read(%header,1)) && ($regex($read(%data,n,1),(\d+))) {
  140. msg %chan http://strawpoll.me/ $+ $regml(1)
  141. }
  142. else msg %chan Could not create poll.
  143.  
  144. hfree -w %sockname
  145. .remove %header | .remove %data
  146. }
  147.  
  148. on *:sockopen:strawpoll.*:{
  149. var %a = sockwrite -n $sockname
  150. %a $hget($sockname,method) $hget($sockname,request) HTTP/1.0
  151. %a Host: $hget($sockname,host)
  152. %a Connection: close
  153. if ($hget($sockname,data) != $null) {
  154. %a Content-Type: application/x-www-form-urlencoded
  155. %a Content-Length: $len($v1)
  156. }
  157. %a $+($crlf,$hget($sockname,data))
  158. }
  159.  
  160. on *:sockread:strawpoll.*:{
  161. var %header
  162. var %headerfile = $hget($sockname,headerfile)
  163. var %datafile = $hget($sockname,datafile)
  164.  
  165. if (!$hget($sockname,header.complete)) {
  166. sockread %header
  167. while (%header != $null) {
  168. write %headerfile %header
  169. sockread %header
  170. }
  171. if ($sockbr) hadd $sockname header.complete $true
  172. }
  173. if ($hget($sockname,header.complete)) {
  174. sockread &read
  175. while ($sockbr) {
  176. bwrite %datafile -1 -1 &read
  177. sockread &read
  178. }
  179. }
  180. }
  181.  
  182. on *:sockclose:strawpoll.*:{
  183. var %header = $hget($sockname,headerfile)
  184. var %data = $hget($sockname,datafile)
  185. var %signal = $hget($sockname,signal)
  186. var %params = $hget($sockname,params)
  187.  
  188. if (%signal) .signal %signal 0 $sockname %header %data %params
  189. else {
  190. hfree -w $sockname
  191. .remove %header | .remove %data
  192. }
  193. }
  194.  
  195. alias urlencode return $regsubex($1-,/([^A-Z0-9])/gi,$+(%,$base($asc(\1),10,16)))
  196.  
  197. on *:TEXT:!blacklist add*:#: {
  198. if ($nick isop #) {
  199. set %blacklist. $+ $chan $addtok($($+(%,blacklist.,$chan),2), $3, 44)
  200. msg # $3 Has been added to my blacklist, anyone using $3 will be timed out for 10 minutes.
  201. }
  202. else {
  203. msg # Sorry $nick $+ , you do not have permission to add words to the blacklist
  204. }
  205. }
  206.  
  207. on *:TEXT:!blacklist del*:#: {
  208. if ($nick isop #) {
  209. set %blacklist. $+ $chan $remtok($($+(%,blacklist.,$chan),2), $3, 44)
  210. msg # $3 Has been removed from the blacklist
  211. }
  212. else {
  213. msg # Sorry $nick $+ , you do not have permission to add words to the blacklist
  214. }
  215. }
  216.  
  217. on *:TEXT:*:#: {
  218. if ($nick isop #) { return }
  219. var %i = 1
  220. while (%i <= $0) {
  221. if ($istok($($+(%,blacklist.,$chan),2), $gettok($1-,%i,32), 44) == $true) {
  222. msg # $nick -> Do not use Blacklisted Words. (Timeout)
  223. msg # .timeout $nick 600
  224. break
  225. }
  226. inc %i
  227. }
  228. }
  229.  
  230. on *:text:*.com*:#:{
  231. if ($read(reglist.txt,nw,$nick)) return
  232. Msg # .timeout $nick 1
  233. Msg # Stop posting links!
  234. }
  235. on *:text:*www.*:#:{
  236. if ($read(reglist.txt,nw,$nick)) return
  237. Msg # .timeout $nick 1
  238. Msg # Stop posting links!
  239. }
  240. on *:text:*http*:#:{
  241. if ($read(reglist.txt,nw,$nick)) return
  242. Msg # .timeout $nick 1
  243. Msg # Stop posting links!
  244. }
  245. on *:text:*https*:#:{
  246. if ($read(reglist.txt,nw,$nick)) return
  247. Msg # .timeout $nick 1
  248. Msg # Stop posting links!
  249. }
  250. on *:text:*.info*:#:{
  251. if ($read(reglist.txt,nw,$nick)) return
  252. Msg # .timeout $nick 1
  253. Msg # Stop posting links!
  254. }
  255. on *:text:*.uk*:#:{
  256. if ($read(reglist.txt,nw,$nick)) return
  257. Msg # .timeout $nick 1
  258. Msg # Stop posting links!
  259. }
  260.  
  261. on *:TEXT:!reg add*:#: {
  262. if ($nick isop #) {
  263. write reglist.txt $$3
  264. msg $chan $$3 has been added to the regular list!
  265. }
  266. if ($read(reglist.txt,nw,$nick)) {
  267. write reglist.txt $$3
  268. msg $chan $$3 has been added to the regular list!
  269. }
  270. }
  271. on *:TEXT:!reg del*:#: {
  272. if ($nick isop #) {
  273. if ($read(reglist.txt,nw,$3)) write -dl $+ $readn reglist.txt
  274. msg # $$3 has been removed from the regular list!
  275. }
  276. if ($read(reglist.txt,nw,$nick)) {
  277. if ($read(reglist.txt,nw,$3)) write -dl $+ $readn reglist.txt
  278. msg # $$3 has been removed from the regular list!
  279. }
  280. }
  281.  
  282. on *:TEXT:!permit*:#: {
  283. if ($nick isop #) && ($2) {
  284. write reglist.txt $2
  285. msg # $2 has been permited to post a link for 20 seconds
  286. .timerRemovePermit 1 20 RemovePermit # $2
  287. }
  288. if ($read(sreglist.txt,nw,$nick)) && ($2) {
  289. write reglist.txt $2
  290. msg # $2 has been permited to post a link for 20 seconds
  291. .timerRemovePermit 1 20 RemovePermit # $2
  292. }
  293. }
  294.  
  295. alias -l addPoints {
  296. if ($1 !isnum) { echo 2 -st $1 is not a number. It needs to be a number. | halt }
  297. var %topic $+($chan,.,$nick)
  298. var %points $calc($readini(Points.ini,%topic,Points) + $1)
  299. writeini -n Points.ini %topic Points %points
  300. return %points
  301. }
  302.  
  303. alias -l lookUpPoints {
  304. var %topic $+($chan,.,$nick)
  305. var %points $readini(Points.ini,%topic,Points)
  306. return %points
  307. }
  308. alias doaddpoints {
  309. if ($3 !isnum) { echo 2 -st $3 is not a number. It needs to be a number. | halt }
  310. var %topic $+($1,.,$2)
  311. var %points $calc($readini(Points.ini,%topic,Points) + $3)
  312. writeini -n Points.ini %topic Points %points
  313. echo -a Added points for %topic
  314. }
  315.  
  316. alias dorempoints {
  317. var %topic $+($1,.,$2)
  318. remini -n Points.ini %topic Points
  319. echo -a Removed points for %topic
  320. }
  321.  
  322. on *:text:!points:#:{
  323. if ((%floodpoints) || ($($+(%,floodpoints.,$nick),2))) { return }
  324. set -u10 %floodpoints On
  325. set -u30 %floodpoints. $+ $nick On
  326. msg # $nick has $readini(Points.ini,$+(#,.,$nick),Points) total points.
  327. }
  328.  
  329. on $*:text:/!points (add|remove)/Si:#:{
  330. if ($nick isop #) {
  331. if ($0 < 3) { msg # Insufficient parameters: Use !points <add|remove> <user> [number] | return }
  332. writeini -n Points.ini $+(#,.,$3) Points $calc($readini(Points.ini,$+(#,.,$3),Points) $iif($2 == add,+,-) $iif($4 isnum,$4,1))
  333. { msg $chan $3 now has $readini(Points.ini,$+(#,.,$3),Points) total points. }
  334. }
  335. else { msg $chan This command is only available to moderators. }
  336. }
  337. on !*:join:#:{
  338. $+(.timerpoints.,#,.,$nick) 0 600 add.pts $+(#,.,$nick)
  339. add.pts $+(#,.,$nick)
  340. }
  341. on !*:part:#:$+(.timerpoints.,#,.,$nick) off
  342. alias -l add.pts {
  343. writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 2)
  344. }
  345.  
  346.  
  347. on *:TEXT:!buyticket &:#:{
  348. if (%raffle == 1) {
  349. if ($2 > 10) {
  350. msg $chan Sorry $nick but you can only up to 10 tickets
  351. }
  352. if ($2 < 11) {
  353. var %i = 0
  354. var %ticket = $2
  355. var %topic = $+(#,.,$nick)
  356. var %user = $readini(Points.ini,%topic,Points)
  357. var %end = 10 * %ticket
  358. var %delete = %user - %end
  359. if (%delete > 0) {
  360. writeini -n Points.ini %topic Points %delete
  361. while (%i < %ticket) {
  362. write Raffle.txt $nick
  363. %i = %i + 1
  364. }
  365. msg $chan $nick you have bought %ticket tickets with %end points.
  366. }
  367. if (%delete < 0) {
  368. msg $chan Sorry $nick you don't have enough points to buy %ticket tickets!
  369. }
  370. }
  371. }
  372. if (%raffle == 0) {
  373. msg $chan Raffle is currently closed!
  374. }
  375. }
  376. on *:TEXT:!raffle open:#:{
  377. if ($nick isop #) {
  378. if (%raffle == 0) {
  379. msg $chan RAFFLE IS NOW OPEN!!
  380. set %raffle 1
  381. write -c Raffle.txt
  382. }
  383. }
  384. }
  385. on *:TEXT:!raffle close:#:{
  386. if ($nick isop #) {
  387. if (%raffle == 1) {
  388. msg $chan RAFFLE IS NOW CLOSED!!
  389. set %raffle 0
  390. write -c Raffle.txt
  391. }
  392. }
  393. }
  394. on *:TEXT:!roll:#:{
  395. if ($nick isop #) {
  396. if (%raffle == 1) {
  397. var %user = $read(Raffle.txt, n)
  398. msg $chan RAFFLE IS NOW BEING ROLLED, GOOD LUCK!!
  399. .timerOne 1 1 msg $chan /me 5!
  400. .timerTwo 1 2 msg $chan /me 4!
  401. .timerThree 1 3 msg $chan /me 3!
  402. .timerFour 1 4 msg $chan /me 2!
  403. .timerFive 1 5 msg $chan /me 1!
  404. .timerSix 1 6 msg $chan AND THE WINNER IS:
  405. .timerSeven 1 7 msg $chan %chat
  406. set %raffle 0
  407. write -c Raffle.txt
  408. }
  409. }
  410. }
Add Comment
Please, Sign In to add comment