Advertisement
Guest User

Untitled

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