Advertisement
Guest User

Untitled

a guest
May 13th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 43.87 KB | None | 0 0
  1. /*
  2. FIQ-bot version 3
  3. Totally rewritten
  4. */
  5.  
  6. ;;;;;;;;;;;;;;;;;;;;;;;;;
  7. ;;; ;;;
  8. ;;; ALIASES ;;;
  9. ;;; ;;;
  10. ;;;;;;;;;;;;;;;;;;;;;;;;;
  11.  
  12. alias urlencode return $regsubex($1-,/\G(.)/g,$iif(($prop && \1 !isalnum) || !$prop,$chr(37) $+ $base($asc(\1),10,16),\1))
  13. alias urldecode return $replace($regsubex($1-,/%(\w\w)/g,$chr($iif($base(\t,16,10) != 32,$v1,1))),$chr(1),$chr(32))
  14. alias chanlistglob { scid -at1 chanlistnet | var %tmp = $mid(%cl.buffer,2) | unset %cl.buffer | return %tmp }
  15. alias chanlistnet { set %cl.buffer $+(%cl.buffer,$chr(44),$network) | var %i = 1 | while ($comchan($me,%i)) { set %cl.buffer $+(%cl.buffer,$chr(44),$v1) | inc %i } }
  16. alias evalfix { return $(,$+(%,$1)) }
  17. alias getaccess {
  18. var %access = %fiqbot_access_ [ $+ [ $1 ] ]
  19. if (%access == 1) { return Normal user }
  20. elseif (%access == 9) { return Master }
  21. elseif (%access == 10) { return Admin }
  22. elseif (%access == 11) { return FireFly }
  23. elseif (!%access) { return Normal user }
  24. else { return User level %access }
  25. }
  26. alias testarsaken { .notice $1 Test-kommando-extension utfört! Testar: $1- | return }
  27. alias initcmd {
  28. if ($1 == -in-channel) { if ($2 == Y) { unset %fiqbot* } }
  29. elseif ($?!="Do you want to unload all FIQ-bot variables?") { unset %fiqbot* }
  30. set %fiqbot_cmd_access 9:[-crl] [nick/host] [level]:Add a nick's host or a host with userlevel [level]. With access-level 9 you can grant 8 or less, with level 10 you can grant full access. Use -r switch for removing access. Use -c switch for check access. Use -l switch for listing connected people with access.
  31. set %fiqbot_cmd_account 9:<password>:Creates an account that you can use in FIQ-bots web-interface (with current nick). If an account on your host already exists, changing password. It's highly recommended to run this command in query.
  32. set %fiqbot_cmd_bf 1:<script>:Evalutes <script> in BF.
  33. set %fiqbot_cmd_channel 2:<channel> [welcome/topic/modes/op/deop/voice/devoice/kick/ban/flags/invite/help] [topic/nick/host/help-page]:Manages the specified channel. For more info, type !FIQ CHANNEL HELP
  34. set %fiqbot_cmd_constant 2:[-cdr] <name> [reply]:Make a custom command in FIQ-bot. The -c switch makes FIQ-bot reply in channel. The -r switch makes FIQ-bot use raw (level 5+). The -d switch deletes the constant. Use &sN for parameter N, &nick for the nick, &chan for the channel.
  35. set %fiqbot_cmd_gtfo 11:(nothing):Makes FIQ leave this network.
  36. set %fiqbot_cmd_deop 3:[#channel] <name>:Deops <name> in current channel, or if #channel is specified, deops in #channel.
  37. set %fiqbot_cmd_devoice 2:[#channel] <name>:Devoices <name> in current channel, or if #channel is specified, devoices in #channel.
  38. set %fiqbot_cmd_function 9:<-h/name> [code]:Make a custom function in FIQ-bot. For info, type -h instead of a name.
  39. set %fiqbot_cmd_ghost 10:(nothing):Kills the FIQ online.
  40. set %fiqbot_cmd_help 1:<command>:Displays help about a command.
  41. set %fiqbot_cmd_join 5:<channel>:Makes FIQ-bot joining <channel>.
  42. set %fiqbot_cmd_kick 3:[#channel] <name> [reason]:Kicks <name> out of the current channel, or if #channel is specified, kicks from #channel. If [reason] is specified, it will be used as kick reason.
  43. set %fiqbot_cmd_mode 4:<nick/host/#channel> [+/-flags]:Sets <nick/host/#channel> with flags. If no flags is specified, show current flags. Nick flags is +a (auto-op), +b (auto-ban), +g (auto-voice). Channel flags is +g (voiceall).
  44. set %fiqbot_cmd_official 1:(nothing):Sets the current channel to "official" and prevent the bot from joining this channel again. This can only be done by IRC Operators or people with user level 10 (Admin).
  45. set %fiqbot_cmd_op 3:[#channel] <name>:Ops <name> in current channel, or if #channel is specified, ops in #channel.
  46. set %fiqbot_cmd_part 5:<channel>:Makes FIQ-bot parting <channel>.
  47. set %fiqbot_cmd_prefix 9:[-s] [prefix]:Changes the prefix FIQ-bot use. Use -s switch for showing current prefix.
  48. set %fiqbot_cmd_reload 10:[-u]:Reloads variables. If -u switch is used, unsets all variables and makes you level 10.
  49. set %fiqbot_cmd_remote 10:<command>:Make FIQ-bot use a mIRC command with custom parameters.
  50. set %fiqbot_cmd_rpgstats 1:[-c] <ip>:Makes FIQ return stats in FIQ-RPG. The -c switch makes FIQ-bot reply in channel.
  51. set %fiqbot_cmd_showcommands -1:[filter]:Shows available commands. If [filter] is specified, showing only commands matching [filter]. Possibility to use ? for 1 char match and * for zero-or-more char match.
  52. set %fiqbot_cmd_todo 1:<add <text>/show>:Add a todo or show your todo list
  53. set %fiqbot_cmd_try 5:<statement>:Check if <statement> is true or false.
  54. set %fiqbot_cmd_typeof 1:<command>:Display type of the command <command> (normal, constant, channelconstant or rawconstant)
  55. set %fiqbot_cmd_version 1:(nothing):Return FIQ-bot version
  56. set %fiqbot_cmd_voice 2:[#channel] <name>:Voices <name> in current channel, or if #channel is specified, voices in #channel.
  57. set %fiqbot_cmd_whoami 1:(nothing):Display info about who you are for me.
  58. set %fiqbot_cmd_whois 1:<nick>:Displays info about <nick>.
  59. set %fiqbot_prefix !
  60. if ($1 == -in-channel) { if ($2 == Y) { set %fiqbot_access_ $+ $address($3,2) 10 } }
  61. else { set %fiqbot_access_*!*@ $+ $?="Enter the auth you want to give max-access to" $+ .users.quakenet.org 10 }
  62. if ($1 == -in-channel) {
  63. .notice $3 Loaded FIQ-bot version 3.0- $+ $iif($authinfo,main,alternate) beta, build 3004
  64. }
  65. else {
  66. echo -ag Loaded FIQ-bot version 3.0- $+ $iif($authinfo,main,alternate) beta
  67. echo -ag Build: 3004
  68. }
  69. }
  70. alias mIf {
  71. tokenize 32 $1-
  72. goto $0
  73. :3
  74. if ($1 $2 $3) { return $true } | return $false
  75. :2
  76. if ($1 $2) { return $true } | return $false
  77. :1
  78. if ($1) { return $true } | return $false
  79. return $false
  80. }
  81.  
  82.  
  83. ;;;;;;;;;;;;;;;;;;;;;;;;;
  84. ;;; ;;;
  85. ;;; EVENTS ;;;
  86. ;;; ;;;
  87. ;;;;;;;;;;;;;;;;;;;;;;;;;
  88.  
  89. on *:START:{
  90. if (!%init_done) { initcmd | set %init_done 1 }
  91. con.start
  92. aline @console --------------------------------------------------------------
  93. aline @console FIQ-bot version 3.0- $+ $iif($authinfo,main,alternate) (3001)
  94. if (!$authinfo) {
  95. aline @console Denna version är en begränsad version. Detta innebär följande:
  96. aline @console * REMOTE är avstängt
  97. aline @console * Automatisk inloggning är avstängt
  98. aline @console * HTTP-funktioner avstängda.
  99. }
  100. aline @console --------------------------------------------------------------
  101. aline @console 
  102. aline @console 
  103. if (!$authinfo) {
  104. aline @console 0,4Begränsad version! HTTP-funktioner avstängda.
  105. }
  106. else {
  107. aline @console Startar HTTP-server...
  108. run C:\xampp\xampp_start.exe
  109. aline @console HTTP-server startad!
  110. aline @console Kör uppdatering!
  111. sockopen localhost2 127.0.0.1 80
  112. timerupdate 0 30 sockopen localhost2 127.0.0.1 80
  113. aline @console Startar kommandomottagare!
  114. timerwebcmd 0 10 sockopen localhost3 127.0.0.1 80
  115. }
  116. aline @console Kopplar upp mot nätverk...
  117. }
  118. on *:CONNECT:{
  119. aline @console Uppkoppling mot $network klar!
  120. aline @console Loggar in...
  121. if (!$authinfo) {
  122. aline @console 0,4Begränsad version! Automatisk auth avstängt.
  123. }
  124. else { .auth $authinfo }
  125. aline @console Joinar kanaler...
  126. join #FIQ-bot
  127. }
  128. on *:JOIN:*:{
  129. if (($chan == #FIQ-bot) && ($nick == $me)) {
  130. aline @console FIQ-bot har nu joinat kanalen $chan
  131. aline @console * INFO: Startkommandon klara.
  132. aline @console 
  133. aline @console --------------------------------------------------------------
  134. aline @console FIQ-bot v3.0- $+ $iif($authinfo,main,alternate) (3004)
  135. aline @console --------------------------------------------------------------
  136. aline @console 
  137. aline @console FIQbot_30 $+ $iif($authinfo,M,A) $+ 3004> 
  138. }
  139. elseif (%official_ [ $+ [ $chan ] ]) { part $chan Official channel | return }
  140. elseif ($nick == $me) {
  141. if (!%fiqbot_joinedbefore_ [ $+ [ $chan ] ]) { msg $chan Joined channel. If you want me to part (requires access-level 5), type !FIQ part. If this channel is an official network channel and you're an IRC Operator, type "!FIQ official" for preventing this channel from being joined in the future. You can also just ban me, but it will mean that I can join this channel in the future (if someone command me to join it). Join command used by: $iif(!%fiqbot_joinedby,(self/unknown),%fiqbot_joinedby) | set %fiqbot_joinedbefore_ [ $+ [ $chan ] ] 1 }
  142. }
  143. if ($evalfix(welcome_ $+ $chan)) { .notice $nick $chr(91) $+ $chan $+ $chr(93) - $evalfix(welcome_ $+ $chan) }
  144. if ($me isop $chan) {
  145. if (%mode_a_ [ $+ [ $address($nick,2) ] ]) { mode $chan +o $nick }
  146. elseif (%mode_g_ [ $+ [ $address($nick,2) ] ]) { mode $chan +v $nick }
  147. elseif (%mode_b_ [ $+ [ $address($nick,2) ] ]) { mode $chan +b $address($nick,2) | kick $chan $nick You've the +b flag }
  148. elseif (%mode_g_ [ $+ [ $chan ] ]) { mode $chan +v $nick }
  149. }
  150. }
  151. on *:TEXT:!showprefix:*:.notice $nick Current prefix: %fiqbot_prefix
  152. on *:TEXT:?FIQ *:*:{
  153. if ($nick == $me) { return }
  154. if (%fiqbot_prefix == $left($1,1)) { continue }
  155. else { return }
  156. goto $iif($(,$+(%,fiqbot_cmd_,$2)),$iif(($gettok($(,$+(%,fiqbot_cmd_,$2)),1,58) <= 1 && (!$gettok($(,$+(%,fiqbot_access_,$address($nick,2))),1,58))) || $gettok($(,$+(%,fiqbot_cmd_,$2)),1,58) <= $(,$+(%,fiqbot_access_,$address($nick,2))),$2,accdenied),unknowncmd)
  157. :accdenied
  158. .notice $nick Access denied. You need level $gettok($(,$+(%,fiqbot_cmd_,$2)),1,58) $chr(124) You are: $getaccess($address($nick,2)) (level $iif(!$gettok($(,$+(%,fiqbot_access_,$address($nick,2))),1,58),1,$gettok($(,$+(%,fiqbot_access_,$address($nick,2))),1,58)) $+ )
  159. return
  160. :unknowncmd
  161. if ($exists($qt($mircdirFIQ-bot\ $+ $2 $+ .fiq))) {
  162. set -u1 % $+ $2 $+ _ $+ nick $nick
  163. set -u1 % $+ $2 $+ _ $+ chan $chan
  164. if ($right($gettok($read($qt($mircdirFIQ-bot\ $+ $2 $+ .fiq),1),1,32),-1) > %fiqbot_access_ [ $+ [ $address($nick,2) ] ]) { .notice $nick Access denied. You need level $right($gettok($read($qt($mircdirFIQ-bot\ $+ $2 $+ .fiq),1),1,32),-1) $chr(124) You are: $getaccess($address($nick,2)) (level $iif(!$gettok($(,$+(%,fiqbot_access_,$address($nick,2))),1,58),1,$gettok($(,$+(%,fiqbot_access_,$address($nick,2))),1,58)) $+ ) | return }
  165. load -rs $qt($mircdirFIQ-bot\ $+ $2 $+ .fiq)
  166. }
  167. elseif (%addon_ [ $+ [ $2 ] ]) { %addon_cmd_ [ $+ [ $2 ] ] $nick $chan $3- | return }
  168. elseif (%constant_ [ $+ [ $2 ] ]) {
  169. if (%constantInChannel_ [ $+ [ $2 ] ]) { msg $chan $replace(%constant_ [ $+ [ $2 ] ],&s1,$3,&s2,$4,&s3,$5,&s4,$6,&s5,$7,&s6,$8,&nick,$nick,&chan,$chan) }
  170. elseif (%constantUseRaw_ [ $+ [ $2 ] ]) { raw $replace(%constant_ [ $+ [ $2 ] ],&s1,$3,&s2,$4,&s3,$5,&s4,$6,&s5,$7,&s6,$8,&nick,$nick,&chan,$chan) }
  171. else { .notice $nick $replace(%constant_ [ $+ [ $2 ] ],&s1,$3,&s2,$4,&s3,$5,&s4,$6,&s5,$7,&s6,$8,&nick,$nick,&chan,$chan) }
  172. return
  173. }
  174. elseif (%function_ [ $+ [ $2 ] ]) {
  175. echo -agt Debug: Startar custom funktion!
  176. unset %cmd
  177. var %script = temp_function_ $+ $2
  178. var %line 1
  179. var %x = 1
  180. var %rand = $rand(1,10000)
  181. var %chan_ [ $+ [ %rand ] ] $chan
  182. var %nick_ [ $+ [ %rand ] ] $nick
  183. var %time_ [ $+ [ %rand ] ] $time
  184. var %me_ [ $+ [ %rand ] ] $me
  185. var %string = $1-
  186. while (%x <= $len(%function_ [ $+ [ $2 ] ])) {
  187. var %char = $right($left(%function_ [ $+ [ $2 ] ],%x),1)
  188. .echo -atg Debug: While fortsätter! Kommandostring: %cmd - Det är if? $iif(%cmd == if,Japp,Nä)
  189. if ((%char == $chr(125)) && (%ifStatementProgress)) { inc %x | unset %cmd | unset %space* | var %char = $right($left(%function_ [ $+ [ $2 ] ],%x),1) | unset %ifStatementProgress | unset %statementIsTrue }
  190. elseif (%char == ;) {
  191. .echo -atg Debug: Kommando upptäckt! Kommandostring: %cmd
  192. tokenize 32 %cmd
  193. var %cmdUsed = $1
  194. if ((%ifStatementProgress) && (!%statementIsTrue)) { xyzzy }
  195. elseif ($2 == =) {
  196. if ($remove($1,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,_,1,2,3,4,5,6,7,8,9,0)) { .notice $nick Error near ' $+ $1-2 $+ ' - Variable may only contain a-z, A-Z and numbers. | return }
  197. elseif ($1 isnum) { .notice $nick Error near ' $+ $1-2 $+ ' - Variable name cannot be an integer. | return }
  198. if (($1 != me) && ($1 != nick) && ($1 != time) && ($1 != chan)) {
  199. if (($left($3,1) == ") || ($3 isnum)) { var % [ $+ [ $1 ] $+ [ _ ] $+ [ %rand ] ] $noqt($3-) }
  200. elseif (% [ $+ [ $3 ] $+ [ _ ] $+ [ %rand ] ] != $null) { var % [ $+ [ $1 ] $+ [ _ ] $+ [ %rand ] ] % [ $+ [ $3 ] $+ [ _ ] $+ [ %rand ] ] }
  201. else { .notice $nick Error near ' $+ $1-3 $+ ' - Variable " $+ $3 $+ " is unknown or undefined. | return }
  202. }
  203. else { .notice $nick Error near ' $+ $1-2 $+ ' - Reserved variable: " $+ $1 $+ " | return }
  204. }
  205. elseif ($2 == .=) {
  206. if ($remove($1,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,_,1,2,3,4,5,6,7,8,9,0)) { .notice $nick Error near ' $+ $1-2 $+ ' - Variable may only contain a-z, A-Z and numbers. | return }
  207. elseif ($1 isnum) { .notice $nick Error near ' $+ $1-2 $+ ' - Variable name cannot be an integer. | return }
  208. if (($1 != me) && ($1 != nick) && ($1 != time) && ($1 != chan)) {
  209. if (($left($3,1) == ") || ($3 isnum)) { var % [ $+ [ $1 ] $+ [ _ ] $+ [ %rand ] ] % [ $+ [ $1 ] $+ [ _ ] $+ [ %rand ] ] $+ $noqt($3-) }
  210. elseif (% [ $+ [ $3 ] $+ [ _ ] $+ [ %rand ] ] != $null) { var % [ $+ [ $1 ] $+ [ _ ] $+ [ %rand ] ] % [ $+ [ $1 ] $+ [ _ ] $+ [ %rand ] ] $+ % [ $+ [ $3 ] $+ [ _ ] $+ [ %rand ] ] }
  211. else { .notice $nick Error near ' $+ $1-3 $+ ' - Variable " $+ $3 $+ " is unknown or undefined. | return }
  212. }
  213. else { .notice $nick Error near ' $+ $1-2 $+ ' - Reserved variable: " $+ $1 $+ " | return }
  214. }
  215. elseif (($1 == msg) || ($1 == notice) || ($1 == action) || ($1 == ctcp) || ($1 == ctcpreply)) {
  216. echo -agt Debug: Msg-kommando detected!
  217. if (($left($2,1) == ") || ($3 isnum)) { var %msgTarget = $noqt($2) }
  218. elseif (% [ $+ [ $2 ] $+ [ _ ] $+ [ %rand ] ] != $null) { var %msgTarget = % [ $+ [ $2 ] $+ [ _ ] $+ [ %rand ] ] }
  219. else { .notice $nick Error near ' $+ $1-2 $+ ' Variable " $+ $2 $+ " is unknown or undefined. | return }
  220. if (($left($3-,1) == ") || ($3 isnum)) { var %message = $noqt($3-) }
  221. elseif (% [ $+ [ $3 ] $+ [ _ ] $+ [ %rand ] ] != $null) { var %message = % [ $+ [ $3 ] $+ [ _ ] $+ [ %rand ] ] }
  222. else { .notice $nick Error near ' $+ $1-3 $+ ' - Variable " $+ $3 $+ " is unknown or undefined. | return }
  223. echo -atg Debug: %msgTarget - %message
  224. if ($1 == ctcp) { msg %msgTarget $chr(1) $+ %message $+ $chr(1) }
  225. elseif ($1 == ctcpreply) { notice %msgTarget $chr(1) $+ %message $+ $chr(1) }
  226. elseif ($1 == action) { msg %msgTarget $chr(1) $+ ACTION %message $+ $chr(1) }
  227. else { $1 %msgTarget %message }
  228. }
  229. elseif ($1 == if) { .notice $nick Error near ' $+ $1- $+ ' - the if statement couldn't be parsed. | return }
  230. else { .notice $nick Error near ' $+ $1- $+ ' - command " $+ $1 $+ " is unknown. | return }
  231. ;raw %cmd
  232. unset %cmd
  233. tokenize 32 %string
  234. }
  235. elseif ($asc(%char) == 32) { echo -agt Debug: Space progressas! | var %spaceIsGoingToSet = 1 }
  236. elseif (%space) { echo -agt Debug: Space detected! | %cmd = %cmd %char | unset %space* }
  237. else { %cmd = %cmd $+ %char }
  238. if (%spaceIsGoingToSet) { %cmd = %cmd $+ %char }
  239. ;echo -atg Debug: % $+ x -> %x $+ , % $+ cmd -> %cmd
  240. inc %x
  241. if (%spaceIsGoingToSet) { var %space = 1 }
  242. if (%cmd == if) {
  243. unset %z
  244. unset %whilestop
  245. while (!%whilestop) {
  246. var %char = $right($left(%function_ [ $+ [ $2 ] ],%x),1)
  247. if ($asc(%char) == 32) { echo -agt Debug: Space progressas! | var %spaceIsGoingToSet = 1 }
  248. elseif (%space) { inc %z | %cmd = %cmd %char | unset %space* }
  249. else { %cmd = %cmd $+ %char }
  250. if (%z == 4) { var %whilestop = 1 }
  251. else { echo -atg Debug: %z }
  252. if (%spaceIsGoingToSet) { %cmd = %cmd $+ %char }
  253. inc %x
  254. if (%spaceIsGoingToSet) { echo -agt Spacevariabel settas! | var %space = 1 }
  255. if (!%char) { .notice $nick Error near ' $+ %cmd $+ ' - Unknown error. | return }
  256. }
  257. tokenize 32 %cmd
  258. var %cmdUsed = $1
  259. if ($left($2,1) != $chr(40)) { .notice $nick Error near ' $+ $1-2 $+ ' - no starting paranthesis in the if. | return }
  260. if ($right($4,1) == $chr(41)) { xyzzy }
  261. else { .notice $nick Error near ' $+ $1-4 $+ ' - no closing paranthesis on right place. (charcheck: $right($4,1) $+ ) | return }
  262. if (($3 != ==) && ($3 != >) && ($3 != <) && ($3 != <=) && ($3 != >=) && ($3 != !=)) { .notice $nick Error near ' $+ $1-3 $+ ' - unknown operator. | return }
  263. if ($right($left($2,2),1) == ") { var %v1 = $noqt($left($2,-1)) }
  264. elseif (% [ $+ [ $right($2,-1) ] $+ [ _ ] $+ [ %rand ] ] != $null) { var %v1 = % [ $+ [ $right($2,-1) ] $+ [ _ ] $+ [ %rand ] ] }
  265. else { .notice $nick Error near ' $+ $1-2 $+ ' - Variable " $+ $right($2,-1) $+ " is unknown or undefined. | return }
  266. if ($left($4,1) == ") { var %v2 = $noqt($left($4,-1)) }
  267. elseif (% [ $+ [ $right($4,-1) ] $+ [ _ ] $+ [ %rand ] ] != $null) { var %v2 = % [ $+ [ $right($4,-1) ] $+ [ _ ] $+ [ %rand ] ] }
  268. else { .notice $nick Error near ' $+ $1-4 $+ ' - Variable " $+ $left($4,-1) $+ " is unknown or undefined. | return }
  269. if (%v1 $3 %v2) { var %statementIsTrue = 1 }
  270. if ($5 != $chr(123)) { .notice $nick Error near ' $+ $1-5 $+ ' - missing opening bracket. | return }
  271. var %ifStatementProgress = 1
  272. inc %x %cmd
  273. unset %cmd
  274. tokenize 32 %string
  275. }
  276. else { echo -atg Kommandot är ingen if, det är: " $+ %cmd $+ ", alltså en if enligt $chr(36) $+ iif? $iif(%cmd == if,Japp,Nä) }
  277. }
  278. if (%cmd) {
  279. tokenize 32 %cmd
  280. if ($1 == $chr(125)) { return }
  281. var %cmdUsed = $1
  282. if ($2 == =) {
  283. if ($remove($1,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,_,1,2,3,4,5,6,7,8,9,0)) { .notice $nick Error near ' $+ $1-2 $+ ' - Variable may only contain a-z, A-Z and numbers. | return }
  284. elseif ($1 isnum) { .notice $nick Error near ' $+ $1-2 $+ ' - Variable name cannot be an integer. | return }
  285. if (($1 != me) && ($1 != nick) && ($1 != time) && ($1 != chan)) {
  286. if (($left($3,1) == ") || ($3 isnum)) { var % [ $+ [ $1 ] $+ [ _ ] $+ [ %rand ] ] $noqt($3-) }
  287. elseif (% [ $+ [ $3 ] $+ [ _ ] $+ [ %rand ] ] != $null) { var % [ $+ [ $1 ] $+ [ _ ] $+ [ %rand ] ] % [ $+ [ $3 ] $+ [ _ ] $+ [ %rand ] ] }
  288. else { .notice $nick Error near ' $+ $1-3 $+ ' - Variable " $+ $3 $+ " is unknown or undefined. | return }
  289. }
  290. else { .notice $nick Error near ' $+ $1-2 $+ ' - Reserved variable: " $+ $1 $+ " | return }
  291. }
  292. elseif (($1 == msg) || ($1 == notice) || ($1 == action) || ($1 == ctcp) || ($1 == ctcpreply)) {
  293. echo -agt Debug: Msg-kommando detected!
  294. if (($left($2,1) == ") || ($3 isnum)) { var %msgTarget = $noqt($2) }
  295. elseif (% [ $+ [ $2 ] $+ [ _ ] $+ [ %rand ] ] != $null) { var %msgTarget = % [ $+ [ $2 ] $+ [ _ ] $+ [ %rand ] ] }
  296. else { .notice $nick Error near ' $+ $1-2 $+ ' Variable " $+ $2 $+ " is unknown or undefined. | return }
  297. if (($left($3-,1) == ") || ($3 isnum)) { var %message = $noqt($3-) }
  298. elseif (% [ $+ [ $3 ] $+ [ _ ] $+ [ %rand ] ] != $null) { var %message = % [ $+ [ $3 ] $+ [ _ ] $+ [ %rand ] ] }
  299. else { .notice $nick Error near ' $+ $1-3 $+ ' - Variable " $+ $3 $+ " is unknown or undefined. | return }
  300. echo -atg Debug: %msgTarget - %message
  301. if ($1 == ctcp) { msg %msgTarget $chr(1) $+ %message $+ $chr(1) }
  302. elseif ($1 == ctcpreply) { notice %msgTarget $chr(1) $+ %message $+ $chr(1) }
  303. elseif ($1 == action) { msg %msgTarget $chr(1) $+ ACTION %message $+ $chr(1) }
  304. else { $1 %msgTarget %message }
  305. }
  306. else { .notice $nick Error near ' $+ $1- $+ ' command " $+ $1 $+ " is unknown. | return }
  307. ;raw %cmd
  308. unset %cmd
  309. tokenize 32 %string
  310. }
  311. return
  312. :error
  313. .notice $nick Error reported by MSL (script %script on line %line command $left(%cmd,20) $+ ): $error
  314. }
  315. else { .notice $nick Unknown command ( $+ $2 $+ ). For a list of commands, type !FIQ SHOWCOMMANDS }
  316. return
  317. :ACCESS
  318. if ((!$4) && ($3 != -l)) { .notice $nick Syntax: !FIQ ACCESS [-crl] [nick/host] [level] | return }
  319. if ($3 == -r) {
  320. if ($address($4,2)) {
  321. if ($getaccess($address($nick,2)) == Admin) { unset %fiqbot_access_ [ $+ [ $address($4,2) ] ] | .notice $nick Done. Current access for $4 $+ : $getaccess($address($4,2)) }
  322. else {
  323. if ($evalfix(fiqbot_access_ $+ $address($4,2)) > 8) { .notice $nick You cannot remove access from $4 $+ . User is $getaccess($address($4,2)) | return }
  324. unset %fiqbot_access_ [ $+ [ $address($4,2) ] ] | .notice $nick Done. Current access for $4 $+ : $getaccess($address($4,2))
  325. }
  326. }
  327. else {
  328. if (!%fiqbot_access_ [ $+ [ *!*@ ] $+ [ $4 ] ]) { .notice $nick Host $4 doesn't exists. | return }
  329. if ($getaccess($address($nick,2)) == Admin) { unset %fiqbot_access_ [ $+ [ *!*@ ] $+ [ $4 ] ] | .notice $nick Done. Current access for $4 $+ : $getaccess(*!*@ $+ $4) }
  330. else {
  331. if ($evalfix(fiqbot_access_*!*@ $+ $4) > 8) { .notice $nick You cannot remove access from $4 $+ . User is $getaccess(*!*@ $+ $4) | return }
  332. unset %fiqbot_access_ [ $+ [ *!*@ ] $+ [ $4 ] ] | .notice $nick Done. Current access for $4 $+ : $getaccess(*!*@ $+ $4)
  333. }
  334. }
  335. }
  336. elseif ($3 == -c) {
  337. if ($address($4,2)) { .notice $nick Address: $address($4,5) $chr(124) FIQ-bot access: $getaccess($address($4,2)) }
  338. else { .notice $nick Address: $ial(* $+ $4,1) $chr(124) FIQ-bot access: $getaccess(*!*@ $+ $4) }
  339. }
  340. elseif ($3 == -l) {
  341. .notice $nick Listing connected people with access -1 or 2+ (level:nick)
  342. var %i = 1
  343. while ($var(fiqbot_access_*,%i)) {
  344. echo -agt Debug: $var(fiqbot_access_*,%i) och address är $right($var(fiqbot_access_*,%i),-15)
  345. if ($ial($right($var(fiqbot_access_*,%i),-15),1)) var %buffer = %buffer $(,$var(fiqbot_access_*,%i)) $+ : $+ $gettok($ial($right($var(fiqbot_access_*,%i),-15),1),1,33) $+ $chr(44)
  346. inc %i
  347. }
  348. .notice $nick $iif(!%buffer,(none),$left(%buffer,-1))
  349. }
  350. else {
  351. if ($address($3,2)) {
  352. if ($getaccess($address($nick,2)) == Admin) { set %fiqbot_access_ [ $+ [ $address($3,2) ] ] $iif($4 > 10,10,$4) | .notice $nick Done. Current access for $3 $+ : $getaccess($address($3,2)) }
  353. else {
  354. if ($evalfix(fiqbot_access_ $+ $address($3,2)) > 8) { .notice $nick You cannot change access for $3 $+ . User is $getaccess($address($3,2)) | return }
  355. set %fiqbot_access_ [ $+ [ $address($3,2) ] ] $iif($4 > 8,8,$4) | .notice $nick Done. Current access for $3 $+ : $getaccess($address($3,2))
  356. }
  357. }
  358. else {
  359. if ($getaccess($address($nick,2)) == Admin) { set %fiqbot_access_ [ $+ [ *!*@ ] $+ [ $3 ] ] $iif($4 > 10,10,$4) | .notice $nick Done. Current access for $3 $+ : $getaccess(*!*@ $+ $3) }
  360. else {
  361. if ($evalfix(fiqbot_access_*!*@ $+ $3) > 8) { .notice $nick You cannot remove access from $3 $+ . User is $getaccess(*!*@ $+ $3) | return }
  362. set %fiqbot_access_ [ $+ [ *!*@ ] $+ [ $4 ] ] $iif($4 > 8,8,$4) | .notice $nick Done. Current access for $3 $+ : $getaccess(*!*@ $+ $3)
  363. }
  364. }
  365. }
  366. return
  367. :ACCOUNT
  368. if (!$authinfo) { .notice $nick This feature is only available in 3.0-main. | return }
  369. if (!$3) { .notice $nick Syntax: !FIQ ACCOUNT <password> | return }
  370. else {
  371. set -u1 %nick $iif(!$evalfix(nick_ $+ $address($nick,2)),$nick,$evalfix(nick_ $+ $address($nick,2)))
  372. set %nick_ $+ $address($nick,2) $nick
  373. set -u1 %password $3
  374. set -u1 %accesslevel %fiqbot_access_ [ $+ [ $address($nick,2) ] ]
  375. sockopen localhost 127.0.0.1 80
  376. }
  377. return
  378. :BF
  379. if (!$3) { .notice $nick Syntax: !FIQ BF <script> | return }
  380. useBf $nick $3-
  381. return
  382. :CHANNEL
  383. if ($3 == WELCOME) {
  384. if (!$4) { .notice $nick Welcome-message for this channel: $iif(!$evalfix(welcome_ $+ $chan),(none),$evalfix(welcome_ $+ $chan)) }
  385. elseif (($4 == none) && (!$5)) { unset %welcome_ $+ $chan $4- | .notice $nick Done. Welcome msg for $chan $+ : $4- }
  386. else { set %welcome_ $+ $chan $4- | .notice $nick Done. Welcome msg for $chan $+ : $4- }
  387. }
  388. elseif ($3 == HELP) {
  389. if (!$4) {
  390. .notice $nick --- Channel management help ---
  391. .notice $nick FIQ-bot supports basic management of channels.
  392. .notice $nick For more info, write !FIQ CHANNEL HELP <topic>
  393. .notice $nick Sub-pages: WELCOME
  394. }
  395. elseif ($4 == welcome) {
  396. .notice $nick Syntax: !FIQ CHANNEL WELCOME <message> $chr(124) Flag required: (none)
  397. .notice $nick Changes the welcome message of current channel.
  398. .notice $nick Example: !FIQ CHANNEL WELCOME this is an awesome welcome message
  399. }
  400. else { .notice $nick Help cannot be found for specified topic. | return }
  401. }
  402. else { .notice $nick Unknown channel command. Commands supported: WELCOME, HELP }
  403. return
  404. :CONSTANT
  405. if (!$4) { .notice $nick Syntax: FIQ constant <keyword> <text>. Parameter support: &s(para-number) | return }
  406. if ($3 == -c) {
  407. if ($evalfix(fiqbot_cmd_ $+ $4)) { .notice $nick Command $4 already exists. | return }
  408. set %constant_ $+ $4 $5-
  409. set %constantInChannel_ $+ $4 1
  410. }
  411. elseif ($3 == -r) {
  412. if ($evalfix(fiqbot_cmd_ $+ $4)) { .notice $nick Command $4 already exists. | return }
  413. if ($evalfix(fiqbot_access_ $+ $address($nick,2)) > 4) { set %constantUseRaw_ $+ $4 1 }
  414. set %constant_ $+ $4 $5-
  415. }
  416. elseif ($3 == -d) {
  417. if (!$evalfix(constant_ $+ $4)) { .notice $nick Constant " $+ $4 $+ " doesn't exists. | return }
  418. unset %constant_ [ $+ [ $4 ] ]
  419. unset %constantInChannel_ [ $+ [ $4 ] ]
  420. unset %constantUseRaw_ [ $+ [ $4 ] ]
  421. }
  422. else {
  423. if ($evalfix(fiqbot_cmd_ $+ $3)) { .notice $nick Command $3 already exists. | return }
  424. set %constant_ $+ $3 $4-
  425. }
  426. .notice $nick Done.
  427. return
  428. :DEOP
  429. if ((!$3) || ((!$4) && ($left($3,1) == $chr(35)))) { .notice $nick Syntax: !FIQ $upper($2) [#channel] <nick> | return }
  430. if ($left($3,1) == $chr(35)) { var %chan = $3 | var %nick = $4 }
  431. else { var %chan = $chan | var %nick = $3 }
  432. if ($me !isop %chan) { .notice $nick I'm not op in %chan | return }
  433. if (%nick !ison %chan) { .notice $nick %nick isn't on %chan | return }
  434. mode %chan -o %nick
  435. .notice $nick Done.
  436. return
  437. :DEVOICE
  438. if ((!$3) || ((!$4) && ($left($3,1) == $chr(35)))) { .notice $nick Syntax: !FIQ $upper($2) [#channel] <nick> | return }
  439. if ($left($3,1) == $chr(35)) { var %chan = $3 | var %nick = $4 }
  440. else { var %chan = $chan | var %nick = $3 }
  441. if ($me !isop %chan) { .notice $nick I'm not op in %chan | return }
  442. if (%nick !ison %chan) { .notice $nick %nick isn't on %chan | return }
  443. mode %chan -v %nick
  444. .notice $nick Done.
  445. return
  446. :FUNCTION
  447. if (!$3) { .notice $nick Syntax: !FIQ FUNCTION <-h/name> [code] | return }
  448. elseif ($3 != -h) {
  449. if (!$4) { .notice $nick $3 contains following code: $evalfix(function_ $+ $3) | return }
  450. set %function_ $+ $3 $4-
  451. .notice $nick Done.
  452. }
  453. else {
  454. if ($4 == 2) {
  455. .notice $nick Page 2 - The [[nick]] used in the "hre" command was a function that returned something. We can call it a identifier. There's many types of default functions. Others is [[chan]], [[time]], [[str]],
  456. .notice $nick [[me]] doing different things. [[chan]], [[time]] and [[me]] works the same as [[nick]] but instead, [[chan]] shows channel, [[time]] current time, [[me]] the botnick.
  457. .notice $nick But functions also can take parameters, as the [[str]] one. For more help, write !FIQ function -h 3
  458. }
  459. elseif ($4 == 3) {
  460. .notice $nick Page 3 - The [[str]] function can take one parameter, a number. The number shows the parameter used in the functions.
  461. .notice $nick Example: If you write this function: !FIQ function hre NOTICE [[nick]] :A parameter: [[str|1]], and then use the function, it will return "A parameter:". Now try write !FIQ hre random
  462. .notice $nick As you see, it returned "A parameter: random" in a notice. For more help, write !FIQ function -h 4
  463. }
  464. elseif ($4 == 4) {
  465. .notice $nick Page 4 - You can also make own identifiers and use them in your functions for returning data.
  466. .notice $nick using the RETURN "special" command. For example, making a "hre2" identifier returning "A nice identifier!", write !FIQ FUNCTION hre2 return A nice identifier!
  467. .notice $nick You can now return "A nice identifier!" only with typing [[hre2]] in your "hre" function. For more help, write !FIQ function -h 5
  468. }
  469. elseif ($4 == 5) {
  470. .notice $nick Page 5 - You can also makes custom functions that take parameters. The parameters used is obetainable with "[[str|N]]" (N = number), just like in a normal function.
  471. .notice $nick For more help, type !FIQ functions -h 6
  472. }
  473. elseif ($4 == 6) {
  474. .notice $nick Page 6 - If statements: If statements is commonly used in more normal scripting and if you're common with it, you already know how it works. If not, an if statement is used to check
  475. .notice $nick if something is true or false and then execute something. An if in FIQ-bot-functions is used this way: "if (statement) $chr(123) command1;command2; $chr(125) $+ ". There's no elseif/else at this moment.
  476. .notice $nick Current operators is == (is equal to), != (is NOT equal to), < (is more than), > (is less than).
  477. }
  478. else {
  479. .notice $nick Page 1 - FIQ-bot supports making own type of functions. You call them as a normal command/constant. Commands is RAW-based but there exists "special" commands. The seperator between commands used is ";".
  480. .notice $nick For example, writing a function returning "abc" in a msg and is named "hre", you write: !FIQ function hre msg nick "abc"
  481. .notice $nick For more help, write !FIQ function -h 2
  482. }
  483. }
  484. return
  485. :GTFO
  486. .msg FIQ !!gtfo
  487. .msg FredrIQ !!gtfo
  488. .msg Fredrik1994 !!gtfo
  489. .notice $nick Done.
  490. return
  491. :GHOST
  492. if (!$authinfo2) { .notice $nick Cannot find auth information, this problably means that this version is 3.0-alternate. | return }
  493. ns ghost $authinfo2
  494. .notice $nick Done.
  495. return
  496. :HELP
  497. if (!$3) { .notice $nick For commands, type SHOWCOMMANDS. For help about a specific command, type !FIQ HELP <command> | return }
  498. .notice $nick Syntax: !FIQ $3 $remove($gettok($(,$+(%,fiqbot_cmd_,$3)),2,58),(nothing)) $chr(124) Access level: $gettok($(,$+(%,fiqbot_cmd_,$3)),1,58)
  499. .notice $nick $gettok($(,$+(%,fiqbot_cmd_,$3)),3,58)
  500. .return
  501. :JOIN
  502. if (!$3) { .notice $nick Syntax: !FIQ JOIN <channel> | return }
  503. if (%official_ [ $+ [ $gettok($3,1,44) ] ]) { .notice $nick This channel is official. The channel couldn't be joined. | return }
  504. set -u3 %fiqbot_joinedby $nick
  505. join $gettok($3,1,44)
  506. .notice $nick Done.
  507. return
  508. :KICK
  509. if ((!$3) || ((!$4) && ($left($3,1) == $chr(35)))) { .notice $nick Syntax: !FIQ $upper($2) [#channel] <nick> [reason] | return }
  510. if ($left($3,1) == $chr(35)) { var %chan = $3 | var %nick = $4 | var %reason = $5- }
  511. else { var %chan = $chan | var %nick = $3 | var %reason = $4- }
  512. if ($me !isop %chan) { .notice $nick I'm not op in %chan | return }
  513. if (%nick !ison %chan) { .notice $nick %nick isn't on %chan | return }
  514. if (%nick == $me) { .notice $nick I don't kick myself. | return }
  515. kick %chan %nick %reason
  516. .notice $nick Done.
  517. return
  518. :MODE
  519. if (!$3) { .notice $nick Syntax: !FIQ MODE <nick/host> [flags] | return }
  520. if ($left($3,1) == $chr(35)) {
  521. if (!$4) {
  522. var %buffer = +
  523. if (%mode_g_ [ $+ [ $3 ] ]) { var %buffer = %buffer $+ g }
  524. .notice $nick Flags in this channel: $iif(%buffer != +,%buffer,(none))
  525. }
  526. else {
  527. if ($left($4,1) == +) {
  528. if (g isin $4) { set %mode_g_ [ $+ [ $3 ] ] 1 }
  529. }
  530. elseif ($left($4,1) == -) {
  531. if (g isin $4) { unset %mode_g_ [ $+ [ $3 ] ] }
  532. }
  533. .notice $nick Done.
  534. }
  535. }
  536. elseif ($ial($3 $+ *)) {
  537. if (!$4) {
  538. var %buffer = +
  539. if (%mode_a_ [ $+ [ $address($3,2) ] ]) { var %buffer = %buffer $+ a }
  540. if (%mode_b_ [ $+ [ $address($3,2) ] ]) { var %buffer = %buffer $+ b }
  541. if (%mode_g_ [ $+ [ $address($3,2) ] ]) { var %buffer = %buffer $+ g }
  542. .notice $nick Flags for $3 $+ : $iif(%buffer != +,%buffer,(none))
  543. }
  544. else {
  545. if ($left($4,1) == +) {
  546. if (a isin $4) { set %mode_a_ [ $+ [ $address($3,2) ] ] 1 }
  547. if (b isin $4) { set %mode_b_ [ $+ [ $address($3,2) ] ] 1 }
  548. if (g isin $4) { set %mode_g_ [ $+ [ $address($3,2) ] ] 1 }
  549. }
  550. elseif ($left($4,1) == -) {
  551. if (a isin $4) { unset %mode_a_ [ $+ [ $address($3,2) ] ] }
  552. if (b isin $4) { unset %mode_b_ [ $+ [ $address($3,2) ] ] }
  553. if (g isin $4) { unset %mode_g_ [ $+ [ $address($3,2) ] ] }
  554. }
  555. .notice $nick Done.
  556. }
  557. }
  558. else {
  559. if (!$4) {
  560. var %buffer = +
  561. if (%mode_a_*!*@ [ $+ [ $3 ] ]) { var %buffer = %buffer $+ a }
  562. if (%mode_b_*!*@ [ $+ [ $3 ] ]) { var %buffer = %buffer $+ b }
  563. if (%mode_g_*!*@ [ $+ [ $3 ] ]) { var %buffer = %buffer $+ g }
  564. .notice $nick Flags for $3 $+ : $iif(%buffer != +,%buffer,(none))
  565. }
  566. else {
  567. if ($left($4,1) == +) {
  568. if (a isin $4) { set %mode_a_*!*@ [ $+ [ $3 ] ] 1 }
  569. if (b isin $4) { set %mode_b_*!*@ [ $+ [ $3 ] ] 1 }
  570. if (g isin $4) { set %mode_g_*!*@ [ $+ [ $3 ] ] 1 }
  571. }
  572. elseif ($left($4,1) == -) {
  573. if (a isin $4) { unset %mode_a_*!*@ [ $+ [ $3 ] ] }
  574. if (b isin $4) { unset %mode_b_*!*@ [ $+ [ $3 ] ] }
  575. if (g isin $4) { unset %mode_g_*!*@ [ $+ [ $3 ] ] }
  576. }
  577. .notice $nick Done.
  578. }
  579. }
  580. return
  581. :OFFICIAL
  582. if ($getaccess($address($nick,2)) != Admin) {
  583. set -u3 %ircopcheck $nick
  584. set -u3 %chan $chan
  585. who $nick
  586. }
  587. else {
  588. set %official_ $+ $chan 1
  589. part $chan This channel will not be joined anymore.
  590. .notice $nick Done. Channel will now be prevented from joining.
  591. }
  592. return
  593. :OP
  594. if ((!$3) || ((!$4) && ($left($3,1) == $chr(35)))) { .notice $nick Syntax: !FIQ $upper($2) [#channel] <nick> | return }
  595. if ($left($3,1) == $chr(35)) { var %chan = $3 | var %nick = $4 }
  596. else { var %chan = $chan | var %nick = $3 }
  597. if ($me !isop %chan) { .notice $nick I'm not op in %chan | return }
  598. if (%nick !ison %chan) { .notice $nick %nick isn't on %chan | return }
  599. mode %chan +o %nick
  600. .notice $nick Done.
  601. return
  602. :PART
  603. if (!$3) { if ($chan == #FIQ-bot) { .notice $nick I don't part this channel. | return } | else { part $chan | .notice $nick Done. | return } }
  604. if ($3 == #FIQ-bot) { .notice $nick I don't part that channel. | return }
  605. part $3
  606. .notice $nick Done.
  607. return
  608. :PREFIX
  609. if (!$3) { .notice $nick Syntax: %fiqbot_prefix $+ FIQ PREFIX [-s] [prefix] | return }
  610. if ($3 == -s) { .notice $nick Current prefix: %fiqbot_prefix }
  611. else { set %fiqbot_prefix $left($3,1) | .notice $nick Done }
  612. return
  613. :RELOAD
  614. if ($3 == -u) { initcmd -in-channel Y $nick }
  615. else { initcmd -in-channel N $nick }
  616. return
  617. :REMOTE
  618. if (1 == 1) { $3- }
  619. else {
  620. .notice $nick Remote disabled for security reasons.
  621. }
  622. return
  623. :RPGSTATS
  624. var %ip = $iif($3 == -c,$4,$3)
  625. if ($3 == -c) { msg $chan Level: $evalfix(level_ $+ %ip) - EXP: $evalfix(exp_ $+ %ip) $+ / $+ $getExpToLevel($evalfix(level_ $+ %ip)) }
  626. else { .notice $nick Level: $evalfix(level_ $+ %ip) - EXP: $evalfix(exp_ $+ %ip) $+ / $+ $getExpToLevel($evalfix(level_ $+ %ip)) }
  627. return
  628. :SHOWCOMMANDS
  629. .notice $nick Following commands are available for you with access " $+ $getaccess($address($nick,2)) $+ ":
  630. var %i = 1
  631. while ($var(fiqbot_cmd_*,%i)) {
  632. if (($gettok($(,$var(fiqbot_cmd_*,%i)),1,58) <= $evalfix(fiqbot_access_ $+ $address($nick,2))) || (($gettok($(,$var(fiqbot_cmd_*,%i)),1,58) <= 1) && (!$evalfix(fiqbot_access_ $+ $address($nick,2))))) { if ((!$3) || ($3 iswm $right($var(fiqbot_cmd_*,%i),-12))) var %buffer = %buffer $right($var(fiqbot_cmd_*,%i),-12) $+ $chr(44) }
  633. inc %i
  634. }
  635. var %i = 1
  636. while ($var(constant_*,%i)) { var %buffer2 = %buffer2 $right($var(constant_*,%i),-10) $+ $chr(44) | inc %i }
  637. .notice $nick Normal commands: $iif(!$upper($left(%buffer,-1)),(none),$upper($left(%buffer,-1))) $chr(124) Constants: $iif(!$upper($left(%buffer2,-1)),(none),$upper($left(%buffer2,-1)))
  638. return
  639. :TODO
  640. if (!$3) { .notice $nick Syntax: FIQ TODO <show/add/done/clear> | return }
  641. if ($3 == show) {
  642. var %i = 1
  643. while (%todo_ [ $+ [ %i ] $+ [ _ ] $+ [ $address($nick,2) ] ]) { inc %i }
  644. if (%i > 5) {
  645. var %i = 1
  646. .notice $nick Todos för $nick $+ :
  647. while (%todo_ [ $+ [ %i ] $+ [ _ ] $+ [ $address($nick,2) ] ]) {
  648. unset %alreadySentAll
  649. if ($calc(%i % 5) == 1) { var %todobuffer * %todo_ [ $+ [ %i ] $+ [ _ ] $+ [ $address($nick,2) ] ] }
  650. else { var %todobuffer %todobuffer $chr(124) * %todo_ [ $+ [ %i ] $+ [ _ ] $+ [ $address($nick,2) ] ] }
  651. if ($calc(%i % 5) == 0) { .notice $nick %todobuffer | %alreadySentAll = 1 }
  652. inc %i
  653. }
  654. if (!%alreadySentAll) { .notice $nick %todobuffer | %alreadySentAll = 1 }
  655. }
  656. elseif (%i == 1) { .notice $nick Du har inga todos atm. }
  657. else {
  658. var %i = 1
  659. .notice $nick Todos för $nick $+ :
  660. while (%todo_ [ $+ [ %i ] $+ [ _ ] $+ [ $address($nick,2) ] ]) {
  661. .notice $nick * %todo_ [ $+ [ %i ] $+ [ _ ] $+ [ $address($nick,2) ] ]
  662. inc %i
  663. }
  664. }
  665. }
  666. elseif ($3 == add) {
  667. if (!$4) { .notice Please type at least 1 word. | return }
  668. var %i = 1
  669. while (%todo_ [ $+ [ %i ] $+ [ _ ] $+ [ $address($nick,2) ] ]) { inc %i }
  670. set %todo_ $+ %i $+ _ $+ $address($nick,2) $4-
  671. .notice $nick Added todo %i $+ : $4-
  672. }
  673. return
  674. :TRY
  675. var %tmp = $(,$3-5)
  676. .notice $nick STATEMENT $3-5 $chr(124) RETURNED: $mif(%tmp)
  677. return
  678. :TYPEOF
  679. if (!$3) { .notice $nick Syntax: !FIQ TYPEOF <command> | return }
  680. if (%constantUseRaw_ [ $+ [ $3 ] ]) { var %type = rawconstant }
  681. elseif (%constantInChannel_ [ $+ [ $3 ] ]) { var %type = channelconstant }
  682. elseif (%constant_ [ $+ [ $3 ] ]) { var %type = constant }
  683. elseif (%addon_ [ $+ [ $3 ] ]) { var %type = addon }
  684. elseif (%fiqbot_cmd_ [ $+ [ $3 ] ]) { var %type = normal }
  685. else { .notice $nick Command $3 doesn't exists. | return }
  686. .notice $nick Type of $3 is " $+ %type $+ ".
  687. return
  688. :VERSION
  689. .notice $nick FIQ-bot version 3.0- $+ $iif($authinfo,main,alternate) beta build 3004
  690. return
  691. :VOICE
  692. if ((!$3) || ((!$4) && ($left($3,1) == $chr(35)))) { .notice $nick Syntax: !FIQ $upper($2) [#channel] <nick> | return }
  693. if ($left($3,1) == $chr(35)) { var %chan = $3 | var %nick = $4 }
  694. else { var %chan = $chan | var %nick = $3 }
  695. if ($me !isop %chan) { .notice $nick I'm not op in %chan | return }
  696. if (%nick !ison %chan) { .notice $nick %nick isn't on %chan | return }
  697. mode %chan +v %nick
  698. .notice $nick Done.
  699. return
  700. :WHOAMI
  701. var %buffer = +
  702. if (%mode_a_ [ $+ [ $address($nick,2) ] ]) { var %buffer = %buffer $+ a }
  703. if (%mode_b_ [ $+ [ $address($nick,2) ] ]) { var %buffer = %buffer $+ b }
  704. if (%mode_g_ [ $+ [ $address($nick,2) ] ]) { var %buffer = %buffer $+ g }
  705. .notice $nick Address: $address($nick,5) $chr(124) Your FIQ-bot access: $getaccess($address($nick,2)) $chr(124) You have following flags set: $iif(%buffer != +,%buffer,(none))
  706. return
  707. :WHOIS
  708. if (!$3) { .notice $nick Syntax: !FIQ WHOIS <nick> }
  709. if (!$ial($3)) { .notice $nick $3 doesn't exists, aren't connected or aren't on any channels with me. | return }
  710. var %buffer = +
  711. if (%mode_a_ [ $+ [ $address($3,2) ] ]) { var %buffer = %buffer $+ a }
  712. if (%mode_b_ [ $+ [ $address($3,2) ] ]) { var %buffer = %buffer $+ b }
  713. if (%mode_g_ [ $+ [ $address($3,2) ] ]) { var %buffer = %buffer $+ g }
  714. .notice $nick Address: $address($3,5) $chr(124) FIQ-bot access: $getaccess($address($3,2)) $chr(124) $3 has following flags set: $iif(%buffer != +,%buffer,(none))
  715. return
  716. }
  717. RAW 354:*:{
  718. if ($2 == %ircopcheck) {
  719. if (* isin $3) {
  720. set %official_ $+ %chan 1
  721. part %chan This channel will not be joined anymore.
  722. .notice %ircopcheck Done. Channel will now be prevented from joining.
  723. }
  724. else { .notice $nick You haven't enough access and you're not an IRC Operator (or the status couldn't be detected) }
  725. }
  726. }
  727.  
  728. ;;;;;;;;;;;;;;;;;;;;;;;;;
  729. ;;; ;;;
  730. ;;; SOCKETS ;;;
  731. ;;; ;;;
  732. ;;;;;;;;;;;;;;;;;;;;;;;;;
  733.  
  734. on *:sockopen:localhost:{
  735. ;to tell the server which file you want to receive
  736. sockwrite -n $sockname GET /fiq-bot/addUser.php?level= $+ %accesslevel $+ &username= $+ %nick $+ &password= $+ %password $+ &host= $+ $address(%nick,2) HTTP/1.0
  737. sockwrite -n $sockname Host: 127.0.0.1
  738. ;this is only needed for a few websites, but it's just more complete to have it ;)
  739. sockwrite -n $sockname user-agent: FIQbot/3.0 (build 3004)
  740. sockwrite -n $sockname Connection: Keep-Alive
  741. sockwrite -n $sockname $crlf
  742. }
  743. on *:sockopen:localhost2:{
  744. ;to tell the server which file you want to receive
  745. sockwrite -n $sockname GET /fiq-bot/update.php?channels= $+ $urlencode($chanlistglob) HTTP/1.0
  746. sockwrite -n $sockname Host: 127.0.0.1
  747. ;this is only needed for a few websites, but it's just more complete to have it ;)
  748. sockwrite -n $sockname user-agent: FIQbot/3.0 (build 3004)
  749. sockwrite -n $sockname Connection: Keep-Alive
  750. sockwrite -n $sockname $crlf
  751. }
  752. on *:sockopen:localhost3:{
  753. ;to tell the server which file you want to receive
  754. sockwrite -n $sockname GET /fiq-bot/cmdinfo.php HTTP/1.0
  755. sockwrite -n $sockname Host: 127.0.0.1
  756. ;this is only needed for a few websites, but it's just more complete to have it ;)
  757. sockwrite -n $sockname user-agent: FIQbot/3.0 (build 3004)
  758. sockwrite -n $sockname Connection: Keep-Alive
  759. sockwrite -n $sockname $crlf
  760. }
  761. on *:sockread:localhost:{
  762. ;same way as in mirc helpfile with the :nextread
  763. if ($sockerr > 0) .notice %nick Error! $sockerr
  764. :nextread
  765. sockread %temp
  766. tokenize 32 %temp
  767. if ($1 == FIQBOTECHO:) { .notice %nick $2- }
  768. echo -s Content: %temp
  769. if (%y) { return }
  770. if ($sockbr == 0) { var %y = 1 }
  771. /*
  772. ;to check if we got the right line, it's pretty easy for this file, but usually more complicated,
  773. ;use $gettok or variables to get the right line.
  774. if (<html> isin %temp) {
  775. ;%temp will contain something like:
  776. ;<html><head><title>Current IP Check</title></head><body>Current IP Address: 217.20.116.184</body></html>
  777. ;an easy way to 'strip' it is with $remove
  778. var %z = $remove(%temp,<html><head><title>Current IP Check</title></head><body>Current IP Address:,</body></html>)
  779.  
  780. ;scon -a is to send a command to all servers mirc is connected to
  781. scon -a localinfo $chr(10) %z
  782. scon -a echo 4 -s ip is set to $ip
  783. }
  784. */
  785. goto nextread
  786. }
  787. on *:sockread:localhost3:{
  788. ;same way as in mirc helpfile with the :nextread
  789. if ($sockerr > 0) .notice %nick Error! $sockerr
  790. :nextread
  791. sockread %temp
  792. tokenize 32 %temp
  793. echo -s Content: %temp
  794. if (($1 == DOCMD:) && ($2)) { $2- }
  795. if (%y) { return }
  796. if ($sockbr == 0) { var %y = 1 }
  797. /*
  798. ;to check if we got the right line, it's pretty easy for this file, but usually more complicated,
  799. ;use $gettok or variables to get the right line.
  800. if (<html> isin %temp) {
  801. ;%temp will contain something like:
  802. ;<html><head><title>Current IP Check</title></head><body>Current IP Address: 217.20.116.184</body></html>
  803. ;an easy way to 'strip' it is with $remove
  804. var %z = $remove(%temp,<html><head><title>Current IP Check</title></head><body>Current IP Address:,</body></html>)
  805.  
  806. ;scon -a is to send a command to all servers mirc is connected to
  807. scon -a localinfo $chr(10) %z
  808. scon -a echo 4 -s ip is set to $ip
  809. }
  810. */
  811. goto nextread
  812. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement