Advertisement
Guest User

Untitled

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